We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Where on a page is my paragraph?

Many customers wanted to access page layout information in Aspose.Words. This included questions such as:

  • Where does a page start or end in a document?
  • Where on a page my paragraph (table, shape etc) is located?
  • How can I tell how much space is left on a page?
  • Can I get the page number of a bookmark?
  • and so on

It was not possible to support any of these scenarios in Aspose.Words because Word documents are "flow-layout" documents and do not contain information about how the document is laid out into pages.

Aspose.Words for .NET 6.0 introduces a rendering engine that formats a document into pages similar to how MS Word does it. At the moment the rendering engine only supports export to PDF, printing and imaging (rendering and saving to images). But the fact that such engine exists means that questions above and many more scenarios will be possible to implement in Aspose.Words.

In the following Aspose.Words releases we plan to start exposting some of the rendering engine in the public API to give you access to location of document elements on pages. Let us know if you have any requirements or suggestions for the new API. Let us know what do you want to see.

Good question. We have an urgent need to be able to tell how many pages are in a section. We just want some text to appear if the section has flowed onto a second page.

In Word, we could do what we want with a field, like this: {IF {SECTIONPAGES}=“1” “” “Continued below”}

However, it appears that Aspose cannot compute a field like that. So, we need to do the computation ourselves. The problem is, we cannot do so because we cannot find out how many pages are in the section.

So, unless Aspose will be enhanced to compute all field types, we really need to be able to get information about the number of pages occupied by a section.

There is a little trick you can do. You can delete all sections from the document except the one you are interested in and call Document.GetPageCount.

Also, if you post your request for Section.GetPageCount in the Support Forums, it will be logged as a feature request and eventually implemented. The good thing about posting in the forums is that you will get an email notification when the feature is released.

This is required functionality as it would allow us to get PageNumbers for an individual section in order to generate TOC (whilst the updatetoc functionality is missing). As currently also the “PAGEREF” Fieldwith /p (to return page number of section) is currently not working when I add to to XML (in order to attempt to generate an initial TOC).


Being able to product a TOC is top priority for me. Either make this available or provide the means for developers to at least be able to construct one programatically. That’s my vote.

I would like to be able to extract all the <paragraphs, images, any given element type> on a given page. Currently I see that it is possible to export a subset of pages to PDF. It would be nice if this were also possible when saving as a docx file. If this were possible, then pages could be exported one at a time, and the openxml could be parsed to extract elements.

We are wanting to use Aspose to create final documents on the fly from an RTF template. One of the issues that we have is that the final document cannot contain the electronic signature block orphaned on the last page by itself. We have tried using the widow/orphan and keep w/next settings in word, but this does not always render the document in an acceptable format as it can possibly pull a large paragraph from the previous page to the last page and thus create too much white space on the second to the last page.

The only acceptable format is to evaluate whether or not the signature block is orphaned on the last page and if it is to put a section break two lines from the bottom of the last paragraph on the previous page, thus forcing the last two lines of the previous page to flow to the last page with the signature block.

Not having the ability to determine which page a given paragraph is on prohibits us from being able to do this in Aspose. Please consider exposing your rendering API publicly as soon as possible as the lack of this functionaly may prevent us from utilize Aspose as our document rendering solution.

Thank you!

We need to know the position where the document (or a paragraph, or a section) ends (the x,y coordinates).

When is this functionality going to be implemented ?



We also need this functionality very urgent. Are there any plans to implement this in the near future?

Best regards


Just a note to Aspose. I’ve been monitoring this forum ever since I posted my comment 1 year ago. We’re still in need or the solution discussed here and would appreciate an updated status on your plans.