Hi,
Hi Mantu,
Thanks for your inquiry.
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:
http://www.aspose.com/docs/display/wordsnet/LayoutCollector+class
http://www.aspose.com/docs/display/wordsnet/LayoutEnumerator+class
In
your case, I suggest you please use the
LayoutCollector.getStartPageIndex method to get 1-based index of the
page where node begins. I suggest you following solution for your
scenario.
1) Get the page number of last node of document using LayoutCollector.getStartPageIndex
2) Insert the new Paragraph which you want to insert and get the Paragraph object
3) Get the page number of last Run node of inserted Paragraph. If this Paragraph has only one Run node, please insert a Run node with empty text at the end of this paragraph and get the page number of this new run node.
4) If page number (in first step) is not equal to the page number (get in step 3), please
insert the page break at the position of inserted paragraph.
Hope this helps you. Please let us know if you have any more queries.
Thanks Tahir for your response. I actually have the paragraph as part of a frame hence it does not go over to the next page. It continues to add the paragraphs within the current page till it becomes invisible. I wanted to know if it is possible to find out if the paragraph added to the frame has reached the lower bounds of the page. If i can know it then i can add a page break before adding the next frame paragraph while building the document.
Hi Mantu,
Thanks for your inquiry. It would be great if you please share following detail for investigation purposes. We will then provide you more information on this along with code.
- Please attach your input Word document.
- Please
attach your target Word document showing the desired behavior. You can
use Microsoft Word to create your target Word document. I will
investigate as to how you are expecting your final document be generated
like.
Hi Tahir,
Hi Mantu,
Thanks for your inquiry. Please manually create your expected Word document using Microsoft Word and attach it here for our reference. We will investigate how you want your final Word output be generated like.
Please also attach your input Word document. We will then provide you more information on this along with code.