OO-Snippets: mergeCells

Commons

Keywords
LanguageooRexx
ApplicationCalc
AuthorsMichael Hinz (initial)
Supported Versions2.0.x  
Supported OSWin32  
QuestionHow to merge cells
Answer

Code-Snippet-Listing (snippet-source)

/* get the desktop  (an Xdesktop object) */
oDesktop = UNO.createDesktop()   
xComponentLoader = oDesktop~XDesktop~XComponentLoader      --get componentLoader interface
                                                      
/* open a blank calc file */
url = "private:factory/scalc"
xCalcComponent = xComponentLoader~loadComponentFromURL(url, "_blank", 0, .UNO~noProps)


/* get first sheet in spreadsheet */
xDocument = xCalcComponent~XSpreadSheetDocument
xSheet = xDocument~getSheets~XIndexAccess~getByIndex(0)~XSpreadSheet

/* insert  value into cells */
CALL UNO.setCell xSheet, 0, 0, "Student"

CALL syssleep 3
/* create and retrieve a CellRange*/
xCellRange = xSheet~xCellRange~getCellRangeByName("A1:A5")

/* merge the cells */
xMergeRange = xCellRange~xMergeable
xMergeRange~merge(.true)

::requires UNO.cls       -- get UNO support

Changelog

DateUserModification

and