I am working on Java API which interacts with OpenOffice(swriter) through UNO. For TextTable, I am having hard time setting TableColumn's "OptimalWidth" property.
I have tried the following code and it seems that getColumns() method cannot take me to TableColumn's property and let you only insert and remove columns.
XTableColumns xColumns = xTextTable.getColumns();
XIndexAccess xIndexAccess = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xColumns);
for (int i = 0; i < xIndexAccess.getCount(); i++) {
XPropertySet xColumnProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, (Any) xIndexAccess.getByIndex(i));
if (xColumnProps != null) {
xColumn.setPropertyValue("OptimalWidth", new Boolean(true));
}
}
Can anyone help me out or give me any tips setting OptimalWidth property for a table? Thank you very much in advance!