【发布时间】:2009-09-01 20:36:47
【问题描述】:
我正在研究通过 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 属性的提示? 非常感谢您!
【问题讨论】:
标签: java api openoffice.org openoffice-writer