Insert HTML changes page orientation

Hello,

I am inserting html text into the document.
The document has the page size A4 and orientation landscape.
When I insert an html text where the page size is defined, the document changes the page orientation to portrait.
How can I insert the same html text with keeping the page in landscape?
i have tested this with Aspose 23.7

Here my sample code:

Aspose.Words.Document aspDoc = new Aspose.Words.Document(); 
DocumentBuilder db = new DocumentBuilder(aspDoc); 
db.PageSetup.PaperSize = PaperSize.A4; 
db.PageSetup.Orientation = Orientation.Landscape; 
db.Writeln("Test page layout landscape"); 
db.InsertHtml(System.IO.File.ReadAllText("pagelayout.html"), HtmlInsertOptions.UseBuilderFormatting); 
aspDoc.Save("result.docx");

Here is the html text zipped.
pagelayout_html.zip (886 Bytes)

@cternek
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-25722

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

May I ask what the outcome was of the analysis?
Will this issue be fixed or is there another solution to this?

@cternek Unfortunately, currently there is no solution for this issue. It is not yet scheduled for development. We will keep you informed and let you know once it is resolved.

May we ask if there will be a solution for this in the future?
Can you give us technical details why the page layout is changing?
Is it intended that the page layout changes when it is defined in the html?

@cternek I will consult with the responsible developer and provide you more information.

@alexey.noskov Could you reach the dev for more information?

@cternek The development team is discussing the behavior, but at the moment there is no conclusion whether the current behavior is a bug or an expected behavior. We will keep you updated and let you know once the discussion is finished.

@cternek Please accept our apologies for the long time taken for discussion of the issue and thank you for your patience. After discussion we have decided to implement the following behavior within work on the issue:
If the current section of DocumentBuilder is not empty then PageSetup from the inserted sections will be applied except the last section, which will use the current DocumentBuilder section PageSetup.
Particular case, when a document with one section is inserted into not empty section, like in your case, PageSetup from HTML will not be applied and will remain the same as is specified for the current section.
But if HTML is inserted into an empty document, page setup from HTML will be applied to the inserted content.

Thank you for the details.
May I ask if there is a date when the fix/change will be available?

@cternek Currently the issue is scheduled for development in 24.1 version of Aspose.Words, i.e. January 2024.

@alexey.noskov Hey, I just wanted to check if there is any news regarding the fix for issue.
Will the fix still make it into version 24.1?

@cternek The issue is not resolved yet, but it is still scheduled to be fixed in 24.1 version of Aspose.Words. We will be sure to let you know once the issue is resolved.

1 Like

Hey @alexey.noskov , I noticed Aspose 24.1 has been released, but the issue hasn’t been solved :frowning:
Will the fix be part of the next version or is that also not sure?

@cternek The issue has been rescheduled to 24.2 version. But since it is not resolved yet, currently you cannot 100% rely on this estimate. Please accept our apologies for your inconvenience.

The issues you have found earlier (filed as WORDSNET-25722) have been fixed in this Aspose.Words for .NET 24.3 update also available on NuGet.

1 Like