How to get aspose word table width?
@vineeth.pv Table with on MS Word is not necessarily fixed and can vary depending on the table content.
If preferred width of the table is set, you can get it using Table.PreferredWidth property.
If you need to calculate width of the table in the document how it is displayed, you can use LayoutCollector and LayoutEnumerator classes. For example see the following code:
Document doc = new Document(@"C:\Temp\in.docx");
LayoutCollector collector = new LayoutCollector(doc);
LayoutEnumerator enumerator = new LayoutEnumerator(doc);
// Get table.
Table table = doc.FirstSection.Body.Tables[0];
// Calculate rectange ocuped by the first row in the table.
// Width of this row can be considered as a width of the table.
enumerator.Current = collector.GetEntity(table.FirstRow.FirstCell.FirstParagraph);
while (enumerator.Type != LayoutEntityType.Row)
enumerator.MoveParent();
// Print rectangle ocupied by the row.
Console.WriteLine(enumerator.Rectangle);