I am using the aspose.word product to mail merge a .NET dataset into a word document template.

After I do this, I use the aspose.pdf product to turn that word document into a PDF file.

When I merge the file, it is possible to have anywhere between 4 and 6 pages on the resulting word document.

On my word document, I have a NUMPAGES field at the top so I can let the reader know how many pages are included. This NUMPAGES is not being updated… so if my template has 4 pages, and the merged document has 6 pages, the number of pages listed on the resulting word document (and then the PDF of course) is still 4 … and therefore incorrect.

Do you have any suggestions on how I can update the number of pages? Ideally, it would be a document.refresh or field.update or something like that.




Aspose.Word does not evaluate fields so there is no way to refresh or update them. Aspose.Word also does not know how many pages the document will take because it does not paginate or render them. All of these features will be avilable in the future.

The simplest workaround is that if you know how many pages will be in the document, just insert the number yourself instead of relying on the numpages field.

However, I see a good idea for a new feature in your request. Aspose.Pdf has “fields” to insert page number and number of pages, so I can make Aspose.Word to convert NUMPAGES and PAGE fields into the commands that Aspose.Pdf can understand and it will render them correctly. I will add this on to our task list and release in the next hotfix, probably next week.


What would you say the chances of this coming out next week are?

Would it be possible for you to let me know for sure?

I don’t really have a good way of knowing how many pages I will have because it depends on how many records are in my various DataTables. So, if you are able to get this done soon (in a week or two) I would certainly be willing to wait.



This feature is an easy change for us, so it will be in the next hotfix sometime next week.


This feature has just been released in Aspose.Word 1.8.