Michael Hinz
How to merge cells
/* get the desktop (an Xdesktop object) */
oDesktop = UNO.createDesktop()
xComponentLoader = oDesktop~{%see com.sun.star.frame.XDesktop%XDesktop}~{%see com.sun.star.frame.XComponentLoader%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~{%see com.sun.star.sheet.XSpreadsheetDocument%XSpreadSheetDocument}
xSheet = xDocument~getSheets~{%see com.sun.star.container.XIndexAccess%XIndexAccess}~getByIndex(0)~{%see com.sun.star.sheet.XSpreadsheet%XSpreadSheet}
/* insert value into cells */
CALL UNO.setCell xSheet, 0, 0, "Student"
CALL syssleep 3
/* create and retrieve a CellRange*/
xCellRange = xSheet~{%see com.sun.star.table.XCellRange%xCellRange}~getCellRangeByName("A1:A5")
/* merge the cells */
xMergeRange = xCellRange~{%see com.sun.star.util.XMergeable%xMergeable}
xMergeRange~merge(.true)
::requires UNO.cls -- get UNO support