Hi,
Am 19.09.2013 13:36, schrieb K.Misha:
Hello!
I have this code:
Reference < XTextDocument > xTextDocument (xWriterComponent,UNO_QUERY);
Reference< XModel > aDrawDoc (xTextDocument, UNO_QUERY);
Reference<XMultiServiceFactory> aFact(aDrawDoc,UNO_QUERY);
Reference< XTextTable > xTextTable(
aFact->createInstance(OUString::createFromAscii("com.sun.star.text.TextTable
")), UNO_QUERY);
xTextTable->initialize(4,4);
Reference<XText> xText = xTextDocument->getText();
Reference<XTextRange> xTextRange = xText->getStart();
Reference<XTextContent> xTextContent(xTextTable, UNO_QUERY);
xText->insertTextContent( xTextRange, xTextContent, 0 );
Reference<XTableColumns> xTableColumns = xTextTable->getColumns();
Any rCol = xTableColumns->getByIndex(0);
Reference< XPropertySet > xPropSet2(rCol, UNO_QUERY);
Any mPropVal1 <<= makeAny((unsigned short)150);
But here i have an error:
xPropSet2->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Width")),
mPropVal1);
Can you help me with changing column properties in text table?
you have to use the com.sun.star.text.TableColumnSeparator.
In Java this can look like this:
XTextTablesSupplier xTablesSupplier = (XTextTablesSupplier)
UnoRuntime.queryInterface(XTextTablesSupplier.class, xTextDocument);
XTextTable xTextTable = (XTextTable)
UnoRuntime.queryInterface(XTextTable.class,
xTablesSupplier.getTextTables().getByName("Table1"));
XPropertySet xPropertySet = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xTextTable);
com.sun.star.text.TableColumnSeparator[] sep = (TableColumnSeparator[])
xPropertySet.getPropertyValue("TableColumnSeparators");
sep[0].Position = 1000;
xPropertySet.setPropertyValue("TableColumnSeparators", sep);
Regards
Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org