我需要在Writer表中合并单元格,但是我在找到我所拥有的单元格的名称时遇到了问题 .
XCell xCell = getCell(column, row);
XTextTableCursor textTableCursor = null;
try {
textTableCursor = xTextTable.createCursorByCellName(???????????);
textTableCursor.goRight(mergeCol, true);
textTableCursor.goDown(mergeRow, true);
textTableCursor.mergeRange();
} catch (Exception ex) {
}
我需要找出如何获取 XCell
的名称,或者如何根据 short
列和行索引找到它,以便通过 xTextTable.createCursorByCellName
获取 XTextTableCursor
对象 .
2 回答
阿克塞尔,
那种指向正确的方向,但我应该注意到XCell接口没有getPropertyValue方法 . 相反,需要获取XCell对象的XPropertySet . 以下是完整的代码:
如果您有
com.sun.star.text.Cell
,则此类包含服务com.sun.star.text.CellProperties
. 此服务提供属性CellName .http://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1text_1_1Cell.html
那么,如果你的xCell真的是com.sun.star.text.Cell,那么
但是在libreoffice API中没有getCell方法,所以我不知道这究竟会返回什么 .
问候
阿克塞尔