How to read Tables in a word document with vb.net

Hi

How to read Tables in a word document with content in vb.net.

Thanks
Anil K.

Hi Anil,

Thanks for your inquiry. We suggest you please read about Aspose.Words document object model from here:
Aspose.Words Document Object Model

Please use following code example. Hope this helps you.

Dim doc As New Document(MyDir + "in.docx")
For Each table As Table In doc.GetChildNodes(NodeType.Table, True)
    For Each row As Row In table.Rows
        For Each cell As Cell In row.Cells
            Console.WriteLine(cell.ToString(SaveFormat.Text))
        Next
    Next
Next

Hi,

How to read table, row, cell height,width, alignment in a document. I want to read table properties to display table object as same as in my source document.

Thanks
anil kasa.

Hi Anil,

Thanks for your inquiry.

We suggest you please read the members of Table, CellFormat, and RowFormat classes. Please refer to the following article. Hope this helps you.
Applying Formatting to Table, Row and Cell

Please let us know if you have any more queries.

Hi

How to read images in a table and how to read table inside a table.In documentation mostly i find only document creation, But I want to read document.

Thanks
Anil K.

Hi Anil,

Thanks for your inquiry. Please use CompositeNode.GetChildNodes method (NodeType, Boolean) to get a live collection of child nodes that match the specified type.

Following code snippet shows how to get images from table and nested tables. Hope this helps you.

Dim doc As New Document(MyDir + "in.docx")
For Each table As Table In doc.GetChildNodes(NodeType.Table, True)
    '' Get nested tables
    For Each nestedtable As Table In doc.GetChildNodes(NodeType.Table, True)
    Next
Next
For Each table As Table In doc.GetChildNodes(NodeType.Table, True)
    '' Get images from table
    For Each shape As Shape In doc.GetChildNodes(NodeType.Shape, True)
        If (shape.HasImage) Then
        End If
    Next
Next