adjust cell text table Nicole Scholz How can I adjust table cell text?

In this example table cell text is adjusted to the right.

/* adjust table cell text to the right */ /* Retrieve the Desktop object, we need its XComponentLoader interface to load a new document*/ oDesktop = UNO.createDesktop() -- get the UNO Desktop service object xComponentLoader = oDesktop~{%see com.sun.star.frame.XDesktop%XDesktop}~{%see com.sun.star.frame.XComponentLoader%XComponentLoader} -- get componentLoader interface /* open the blank file */ url = "private:factory/swriter" xWriterComponent = xComponentLoader~loadComponentFromURL(url, "_blank", 0, .UNO~noProps) -- import the enum call bsf.import "{%see com.sun.star.style.ParagraphAdjust}", "paragraphAdjust" xDocumentFactory = xWriterComponent~{%see com.sun.star.lang.XMultiServiceFactory%XMultiServiceFactory} xTextDocument = xWriterComponent~{%see com.sun.star.text.XTextDocument%XTextDocument} xText = xTextDocument~getText() xTextCursor = xText~createTextCursor() xPropertySet = xTextCursor~{%see com.sun.star.beans.XPropertySet%xPropertySet} xDMsf = xTextDocument~{%see com.sun.star.lang.XMultiServiceFactory%XMultiServiceFactory} /* create the table */ xTextTable = xDMsf~createInstance("{%see com.sun.star.text.TextTable}")~{%see com.sun.star.text.XTextTable%XTextTable} xTextTable~initialize(1, 2) -- initialize the table /* insert TextTable in the Text */ xText~insertTextContent(xTextCursor, xTextTable, .false) /* insert text into the table */ call setCellText "A1", "text", xTextTable ::requires UNO.cls -- routine to set the cell text ::routine setCellText use arg cell, text, xTextTable xCellText = xTextTable~getCellByName(cell)~{%see com.sun.star.text.XText%XText} xCellCursor = xCellText~createTextCursor() -- set the property of the cell text cursorProps = xCellCursor~{%see com.sun.star.beans.XPropertySet%XPropertySet} -- adjust the cell text to the right cursorProps~setPropertyValue("ParaAdjust", .paragraphAdjust~"RIGHT") xCellText~setString(text) return