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

Free Support Forum - aspose.com

Document.UpdateTableLayout changes the width of table using .NET

Under the premise that the table width category is Points, when I used “Table.PreferredWidth.Value" to get the table width, I found that the obtained width was not correct. As you can see in the document, the table obviously exceeded the bodyWidth to reach the edge of the page, while the obtained width was actually smaller than the bodyWidth (bodyWidth = pagewidth-left margin-right margin). When the table width is a percentage, I use the cell width of the table to sum the table width, but the cell width also has this problem. Please check if your bug caused this problem. Is there any way to circumvent the problem? And I feel this problem may be related to a bug I mentioned earlier (https://forum.aspose.com/t/table-layout-is-incorrect-when-compatibility-mode-is-set-to-2010-using-net/211124)!

Note: I used 2010 compatibility mode when I initialized the document object:
string file = “c:\3256.docx”;
Document doc = new Document(file);
doc.CompatibilityOptions.OptimizeFor(Aspose.Words.Settings.MsWordVersion.Word2010);
doc.UpdateTableLayout();

Error source:this is the err document
ERROR.zip (751.1 KB)

@TobyLiu

We have tested the scenario using the latest version of Aspose.Words for .NET 20.7 and have not found the shared issue. So, please use Aspose.Words for .NET 20.7.