Aspose Words - Get table width


Is there a way to get the table width in Aspose Words ?
I found this:
lTable.PreferredWidth = PreferredWidth.FromPercent(100);

But I wan’t to use it only if the table is large enough and it overflows the page,

hoping that it will make it fit.

I guess that lTable.PreferredWidth doesn’t return the actual width…


Hi Kostas,

Thanks for your inquiry. I would suggest you please read the following article on specifying Table and Cell widths:

Moreover, please use the CellFormat.With property the get the width of the cell in points. When the parent table’s Auto Fit option is disabled, then this property specifies the actual width of the cell. but when the parent table’s Auto Fit option is enabled, then this width can be updated by the table layout algorithm according to PreferredWidth of this cell and other factors.

The preferred width (along with the table’s Auto Fit option) determines how the actual width of the cell is calculated by the table layout algorithm. Table layout can be performed by Aspose.Words when it saves the document or by Microsoft Word when it displays the document.

The preferred width can be specified in points or in percent. The preferred width can also be specified as “auto”, which means no preferred width is specified.