Reading a table from a word doc

When Aspose words retreives a table form a word document, it returns a long string of all the table content. Is it possible to load the table data with spaces between cells?

Hi,

Thanks for your inquiry. Unfortunately, I have not completely understood your query. Perhaps, you want to get the contents of table’s cell.

The CompositeNode.GetChildNodes returns a live collection of child nodes that match the specified type. The NodeType specifies the type of a Word document node. Please use CompositeNode.GetChildNodes with NodeType.Cell to get the collection of table’s cell as shown in following code snippet.

You can get the text of each cell by using following code snippet.

Document doc = new Document(MyDir + "table.docx");
Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
foreach (Cell cell in table.GetChildNodes(NodeType.Cell, true))
{
    Console.Write(cell.GetText());
}

Hope this answers your query. If this does not help you, please share some more information about your query.