UNO を介して OpenOffice(swriter) と対話する Java API に取り組んでいます。TextTable の場合、TableColumn の "OptimalWidth" プロパティを設定するのに苦労しています。
次のコードを試してみましたが、getColumns() メソッドでは TableColumn のプロパティに移動できず、列の挿入と削除しかできないようです。
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));
}
}
誰かが私を助けたり、テーブルの OptimalWidth プロパティを設定するヒントを教えてくれますか? 事前にどうもありがとうございました!