ich möchte von Java aus Tabulatoren in einem Writer-Dokument setzen. Mit basic habe ich das ganz einfach so gemacht:
- dim newstops(2) as object
dim tabStop As New com.sun.star.style.TabStop
sUrl = "staroffice.factory:swriter"
oDocument = oDesktop.LoadComponentFromUrl(sUrl,"_blank",0,mNoArgs)
oStyleFamilies = oDocument.StyleFamilies
oParagraphStyles = oStyleFamilies.getByName("ParagraphStyles")
oStdPage = oParagraphStyles.getByName("Standard")
tabStop.position = 7000
tabStop.alignment = com.sun.star.style.TabAlign.LEFT
newstops(0) = tabStop
tabStop.position = 8000
tabStop.alignment = com.sun.star.style.TabAlign.LEFT
newstops(1) = tabStop
oStdPage.ParaTabstops=newstops()
- XNameContainer xParagraphStyles = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xStyleFamilies.getByName("ParagraphStyles"));
Object oStandard = xParagraphStyles.getByName("Standard");
TabStop[] newTabStop = new TabStop[2];
newTabStop[0] = new TabStop(); ;
newTabStop[0].Position = 7000;
newTabStop[0].Alignment = com.sun.star.style.TabAlign.LEFT;
newTabStop[1] = new TabStop(); ;
newTabStop[1].Position = 8000;
newTabStop[1].Alignment = com.sun.star.style.TabAlign.LEFT;
dDocument = xComponentLoader.loadComponentFromURL(sUrl, "_blank", 0, mFileProperties);
XTextDocument xTextDocument = (XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, dDocument);
XText oText = xTextDocument.getText();
oCursor = oText.createTextCursor();
XPropertySet xTextCursorProps = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, oCursor);
xTextCursorProps.setPropertyValue("ParaTabStops", newTabStop);
Vielen Dank schon mal!