Hi,
I would like to know how can I read table rows and cells from word document using aspose.words
Thanks
This message was posted using Email2Forum by babar.raza.
Hi,
I would like to know how can I read table rows and cells from word document using aspose.words
Thanks
This message was posted using Email2Forum by babar.raza.
Hello
Thanks for your request. I think, you can use the following code to achieve what you need:
// Open document.
Document doc = new Document("in.docx");
// Get all tables.
NodeCollection tables = doc.GetChildNodes(NodeType.Table, true);
// Loop through all Tables.
foreach (Table table in tables)
{
// Loop through all Rows within the Table.
foreach (Row row in table.Rows)
{
// Loop through all Cells within the Row.
foreach (Cell cell in row.Cells)
{
}
}
}
Best regards,
Hi Ajeesh,
Thanks for your inquiry. I would suggest you please read the following article to learn the structure of Tables in Aspose.Words:
https://docs.aspose.com/words/net/working-with-tables/
Moreover, you can iterate through Tables by using the following code snippet:
Document document = new Document(@"C:\test\WordDocument.doc");
NodeCollection tables = doc.GetChildNodes(NodeType.Table, true);
foreach (Table table in tables)
{
foreach (Row row in table.Rows)
{
foreach (Cell cell in row.Cells)
{
}
}
}
I hope, this will help.
Best Regards,