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");
@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.
@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 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.
@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.
Hey @alexey.noskov , I noticed Aspose 24.1 has been released, but the issue hasn’t been solved
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.