How do I locate a table in a document using the SDK

Given a writer document with multiple tables in it, how do I get a specific table object and then once found how do I specify a row. I want to delete certains rows. I’m writing in VB.net but I’ll take any language solution.

Figured it out from the SDK samples. It took some trial and error. Sorry for the VB. Given that you have an xTextDocument this will locate a table by it’s name.

    Dim xTableSupplier As XTextTablesSupplier = DirectCast(xTextDocument, XTextTablesSupplier)
    Dim xTables As container.XNameAccess = xTableSupplier.getTextTables()
    Dim xTable As XTextTable
    Try
        xTable = xTables.getByName(TableName).Value
    Catch ex As container.NoSuchElementException
        Return False
    End Try

From there you can locate cells by their row column designation. This code was passed in the Row and Col value. They are expressed as you would see them in a spreadsheet. A1 is column A and row 1.

    Dim xCell As table.XCell = xTable.getCellByName(Col & Row)
    If xCell Is Nothing Then Return False
    Dim xText As XText = DirectCast(xCell, XText)
    Dim CellValue As String = xText.getString

I wanted the string value in the cell so it had to be cast as an xText. xCell returns only a double for the possible value.