How to manipulate a table in .odt document?
LibreOffice Basic can use the object model of Open Office. Take the ThisComponent object which is the active document. It has a method to get the tables getTextTables.
This will return an array of table object. Program can iterate each element in the array.
Doc = ThisComponent
TextTables = Doc.getTextTables()
For I = 0 to TextTables.count - 1
Table = TextTables(I)
...
Next
Table object has methods to get row and column. Rows and Columns objects has count method to number of rows/columns in it.
Table uses a grid kind of structure. Cells are identified with a letter that represents column and a number that represents row. For example first cell will be named as A1. A for first column and 1 for first row. C6 will be cell at 3rd column 6th row.
you can get the cell by following code.
Rows = Table.getRows
Cols = Table.getColumns
For RowIndex = 1 To Rows.getCount()
taggedTbl = taggedTbl & rowStart
For ColIndex = 1 To Cols.getCount()
taggedTbl = taggedTbl & cellStart
CellName = Chr(Asc("A") - 1 + ColIndex) & RowIndex
Cell = Table.getCellByName(CellName)
Next
Next
Once you get the cell, you can enumerate that cell and iterate through its elements.
Please let us know if we can provide any further assistance.