We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Words - Get table width

Hello.

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.

EDIT:

I guess that <span style="background-color: white; font-family: Consolas; font-size: 13px;">lTable.PreferredWidth doesn’t return the actual width…

Thanks,
Kostas

Hi Kostas,

Thanks for your inquiry. I would suggest you please read the following article on specifying Table and Cell widths:
http://www.aspose.com/docs/display/wordsnet/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.