Free Support Forum -

Is it posible to know new page added


I’m working on a project using Word Automation to generate Word documents. We encountered performance issue if data is huge. I’m going to propose to use Aspose.Word instead but I’m not sure if your Aspose.Word can do below requirement:

I’d like to render multiple paragraphs into a table which has 3 columns. Each paragraph has a bullet at beginning. Paragraphs are rendered into 1st column at first. If the 1st column is full then continue rendering in the 2nd column then same with the 3rd column.

If all paragraphs are still not fixed into the table, add a break page and a new table, then continue rendering like above.

Can Aspose.Word do this? Can I know if a new page added after rendering a paragraph?



Thanks for your request. To achieve this you do not need to know when new page is started. You should simply use text columns instead of the table. I create a simple code example and attached the output produced by this code:

// Create new document and DocumentBuilder object (it will help us to build a document).

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

// Configure the section to have 3 text columns.


// Start bulleted list and insert N items.


for (int i = 0; i < 1000; i++)


builder.Writeln(string.Format("this is item #{0}", i));


// Save output


Hope this helps.

Best regards,

Thanks. But is there any way to know a new page is started? There is another requirement (separate with previous requirement) in our word report: render paragraphs in one page only, if new page started after rendering a paragraph, stop rendering and undo the last rendered paragraph to remove the new page. Could you show me how to do this?

Thank you very much


Thanks for your inquiry. Unfortunately, there is no way to determine when new page starts. MS Word document is flow document and does not contain any information about its layout into lines and pages. So there is no way to determine where page starts or ends using Aspose.Words.

Best regards,


In word automation, I use ComputeStatistics method of Interop.Word.Document to get page total number to identify if new page is started. Firstly I keep the page total number in a variable before rendering, I get total page number again every time a paragraph is rendered then compare it with the variable. If they are not equal then I know a new page is started.

I’m sure Aspose.Word can work around like this. Could you show me a method like the ComputeStatistics method to get total page number at runtime?


Hi there,

Thanks for your inquiry.

As Alexey has mentioned, Aspose.Words currently cannot directly find the page number of content on the page. We will inform you as soon as this functionality is avaliable.

In the mean time you may find useful the PageNumberFinder class as a work around in the mean time, this class will allow you to find the page number of any node. You can find the class attached to the post here.



Thanks for your request. In your case you can also get number of pages after new content is attached. For this, you should use code like the following:

// Rebuild page layout.


// Get number of pages in the document.

int pages = doc.PageCount;

But you should note that rebuilding page layout is a time-consuming operation. So if you call it many times it can slow down performance of document generation process.

Best regards,

Thanks. Your info is very helpful.

The issues you have found earlier (filed as WORDSNET-2978) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.