Michael Hinz
How can i apply an auto format
/* 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}
CALL syssleep 3
/* insert value into cells */
CALL UNO.setCell xSheet, 0, 0, "Something"
CALL UNO.setCell xSheet, 0, 2, "New"
CALL UNO.setCell xSheet, 0, 4, "Old"
CALL UNO.setCell xSheet, 2, 0, "12"
CALL UNO.setCell xSheet, 2, 4, "43"
CALL UNO.setCell xSheet, 2, 2, "6"
CALL UNO.setCell xSheet, 4, 0, "17"
CALL UNO.setCell xSheet, 4, 4, "49"
CALL UNO.setCell xSheet, 4, 2, "66"
CALL syssleep 3
/* get cell range */
xCellRange = xSheet~{%see com.sun.star.table.XCellRange%xCellRange}~getCellRangeByPosition(0, 0, 5, 5)
/* apply auto format */
xAutoForm = xCellRange~{%see com.sun.star.table.XAutoFormattable%XAutoFormatTable}
xAutoForm~autoFormat("Gelb")
::requires UNO.cls -- get UNO support