Apache OpenOffice (AOO) Bugzilla – Issue 76353
css.table.XTableColumns.getByIndex broken
Last modified: 2013-02-24 21:09:10 UTC
It is impossible to acces by code the columns of a text table, although getByIndex should be supported. The getByIndex call does not show an error, but simply returns a null object. Thus it is impossible to e.g. modify column width by code. Run this in an empty writer document: Sub Main xText = ThisComponent.Text xTextTable = ThisComponent.createInstance("com.sun.star.text.TextTable") xTextTable.initialize(4, 4) xCursor = xText.createTextCursor xText.insertTextContent(xCursor, xTextTable, False) xTableColumns = xTextTable.getColumns() xTableColumn = xTableColumns.getByIndex(0) msgbox IsNull(xTableColumn) End Sub
Confirming with 2.2m7 on WinXP - IsNull(xTableColumn) returns True.
your snippet is correct but the problem is that columns are not supported objects in text tables. The used interface doesn't reflect this because it is to generic. You can say that it is a bad design and i would tend to agree but anyway, getByIndex returns always a null interface in the context of XTableColumns This is an invalid issue and it can't be fixed. But of course it should be reflected in the documentation -> change subcomponent to documentation
I can live with that ...
jsc -> tl: i think we should extend the docu, what do you think? You are the expert of the writer API here and i would like to ask you if you can insert a note in the IDL docu if you think that make sense. Otherwise close the issue.
target 3.x