Page size A4 and orientation is changed after joining documents using .NET

Hi,

We are using the Aspose word version 18.11.0.0 to generate word documents from HTML. Now, we want to migrate to the latest version 20.6.0.0. we are facing two issues which are described below, both of them are producible in the version 18.11.0.0 and 20.6.0.0.

Scenario 1, in our template page size A4 is defined. When word document is generated by using this template, only the first page is produced with A4 size, the rest of the document is generated with a letter-sized page.

Scenario 2, in our template orientation landscape is defined. When word document is generated by using this template, only the first page is produced with landscape orientation, the rest of the document is generated with portrait orientation.

File “A4 Potrait Template.dotx” can be used to generate the scenario for page size. File “A4 Potrait Word Document .docx” is the output document for the page size issue.
File “A4 Landscape Template.dotx” can be used to generate the scenario for orientation. File “A4 Landscape Word Document .docx” is the output document for the orientation issue. File “Sample Html for issue.html” is the sample html to produce both scenarios.

We are using the following code:
Document htmlDoc = new Document(htmlFilePath, new Aspose.Words.HtmlLoadOptions() { LoadFormat = LoadFormat.Html, Encoding = Encoding.UTF8 });
Document templateDocument = new Document(templatePath);
templateDocument.AppendDocument(htmlDoc, ImportFormatMode.UseDestinationStyles);
SaveOutputParameters param = templateDocument.Save(docxFilePath);

Please look into this issue and let us know if any other help is required from our side.

Issue data.zip (92.4 KB)

Regards,
Asif Sharif

@asif.sharif

Please note that you are using Aspose.Words for .NET 20.6 in evaluation mode. Please get the temporary license and apply it before importing document into Aspose.Words’ DOM. We have attached the output document with this post for your kind reference.

You are facing the expected behavior of Aspose.Words. Please note that Aspose.Words mimics the behavior of MS Word. If you perform the same scenario using MS Word, you will get the same output.