Free Support Forum - aspose.com

Table layout is incorrect when compatibility mode is set to 2010 using .NET

When I is to use the “EnumerateLayoutElements” in Aspose.Words for .NET examples repository at GitHub to draw the layout of the Node location, end page 17 and 18 pages there is a big table, table clearly filled the entire width of the part and beyond, but I view the API to draw the Node of the page frame, found that he only accounts for less than half of the whole page width, the difference is affected, the logic of our current project. Please help me to find out what is causing this situation and is there any way to solve it?

Attached is the original document and the detailed screenshot of the error for your reference。
layout error.zip (608.1 KB)

DrawDocumentLayout.zip (695.0 KB)

@TobyLiu

We have tested the scenario using the latest version of Aspose.Words for .NET 20.4 and have not found the shared issue. So, please use Aspose.Words for .NET 20.4. We have attached the output PNG files for your kind reference.
TestFile Page 17 Out.png (142.1 KB)
TestFile Page 18 Out.png (144.5 KB)
TestFile Page 19 Out.png (149.9 KB)

When i update the version of aspose words for .net to 20.4.0,it is also has this error.
On inspection, I found that the difference was caused by calling

Document doc = new Document(file.FullName);
doc.CompatibilityOptions.OptimizeFor(Aspose.Words.Settings.MsWordVersion.Word2010);

while initializing the document. However, I need to use the compatibility mode of 2010. How can I avoid this problem while using the compatibility mode of 2010?

@TobyLiu

Please call Document.UpdateTableLayout method as shown below to get the desired output.

Document document = new Document(MyDir + @"Assessment Paper AY 2019 Semester 2 CE03 MSA Main 1_Version 1.docx");
document.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2010);
document.UpdateTableLayout();
document.Save(MyDir + "20.4.pdf");

I found this problem again, please help to check the cause and solution. Thank you very much ~

Problem description:

When I use the “EnumerateLayoutElements” in Aspose.Words for .NET examples repository at GitHub method, it gets a different layout from the source.

bug doc.zip (1.7 MB)

@TobyLiu

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-20430 . You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi team,

I’d like to ask if this issue 【WORDSNET-20430】 has a repair plan in place? Which version? Or have you fixed it in some version?

@TobyLiu

Your issue is related to missing feature WORDSNET-832 (Make table layout as close to Word as possible). The issue WORDSNET-20430 has been postponed due to this missing feature.

After the fix of WORDSNET-832, we will look into your issue. We will be sure to inform you via this forum thread as soon as this feature is available. We apologize for your inconvenience.