Hi Aspose team,
we are currently experiencing an issue with tables inside a document when changing the documents margins. In the past, we already had an issue with this, which was solved by calling
UpdateTableLayout. See this issue: PDF conversion with margins and tables in doc files
Now, the above method is causing issues for another customer of us with his documents. If the documents left and right margins are set to 1.5 cm and
doc.UpdateTableLayout(); is used, the document output looks different than expected:
The last column will be rendered in two rows instead of one row. If you save the document as docx instead of pdf it looks fine in MS Word, so I assume this is a problem in the pdf rendering process. If the pdf is rendered with word instead, this problem also does not occure.
UpdateTableLayout() this isn´t a problem, but as mentioned above we need this to “fix” the older issue.
I attached you the word document with the outputs. This is the code we use to set the margins:
var doc = new Document(@"S:\in.docx"); var pageSetup = new DocumentBuilder(doc).PageSetup; pageSetup.RightMargin = 42.5; // 1,5 cm pageSetup.LeftMargin = 42.5; // 1,5 cm // Update Tables to new borders doc.UpdateTableLayout(); doc.Save(@"S:\out.doc", SaveFormat.Docx); doc.Save(@"S:\out.pdf", SaveFormat.Pdf);
example.zip (202.6 KB)