Hi Hanh,
Thanks for sharing the detail. The output document does not contain the section break at every page.
You can achieve your requirements using Aspose.Words.Layout classes. Aspose.Words uses our own Rendering Engine to layout documents into pages. The Aspose.Words.Layout namespace provides
classes that allow to access information such as on what page and where
on a page particular document elements are positioned, when the document
is formatted into pages. Please read about LayoutCollector and
LayoutEnumerator from here:
https://reference.aspose.com/words/net/aspose.words.layout/layoutcollector/
https://reference.aspose.com/words/net/aspose.words.layout/layoutenumerator/
You will be able to find out on which page a particular document node (e.g. run, paragraph or table cell) is located by using the GetStartPageIndex, GetEndPageIndex and GetNumPagesSpanned methods. These methods automatically build page layout model of the document and update fields if required.
In your case, I suggest you following solution.
- Please use LayoutCollector.GetStartPageIndex method to get the index of the page where node begins.
- Move the cursor to the desired location. Read about moving cursor from here.
- Insert section break of type continuous at your desired location using DocumentBuilder.InsertBreak.
- Once you have insert the section break, you can change the page orientation using PageSetup.Orientation property.
Hope this helps you. Please let us know if you have any more queries.