Apache OpenOffice (AOO) Bugzilla – Issue 51060
Setting a TextTable name fails the second time.
Last modified: 2013-02-24 21:09:25 UTC
consider the following macro shown blow, which creates a text table with the specified name. Run the macro and the TextTable is created with the requested name. Now, using the GUI, delete the text table. Now, run the macro a second time on the same document. The created name has an extra character appended to the name. Sub Main InsertTableAtCursor("woww") End Sub Sub InsertTableAtCursor(sName$) Dim oText, oTable Dim oCurs Dim sTabName$ If (ThisComponent.getTextTables().hasByName(sName)) Then Print "The table named " & sName & " already exists" Exit Sub End If oText = ThisComponent.getText() oTable = ThisComponent.createInstance("com.sun.star.text.TextTable") oTable.initialize(3, 3) oTable.setName(sname) oCurs = ThisComponent.getCurrentController().getViewCursor() oText.insertTextContent(oCurs, oTable, False) oTable.setDataArray(Array(Array(1, 2, 3), Array(4, 5, 6), Array(7, 8, 9)) MsgBox oTable.getName() End Sub You can verify that the name is not present using the following: MsgBox Join(ThisComponent.getTextTables().getElementNames(), CHR$(10))
sw->tl: seems the writer has a better memory than it should have ;-)