Free Support Forum - aspose.com

Determine the page of a section for the TOC

Hi,

I am dynamically generating a Table of Contents (TOC) as a Table in Aspose.Words. I would like to be able to put the page number where the entry can be found within the document but do not see a way to make this happen. Note that I am not using a MS Word TOC.

Any help is greatly appreciated!

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your interest in Aspose.Words. Unfortunately, you can’t determine number of page where section is started using Aspose.Words. Aspose.Words document represents content and formatting of a document, not its layout into lines and pages. This feature is called pagination and it is not released yet. Please see FAQ for more information.

Best regards.

Just to document, I did find a work around for this. I created a bookmark in the document where I needed to determine the page number. I also inserted a PAGEREF fieldcode with the name of the bookmark in my TOC area. This works great except that the correct page is not displayed until you update the fields in MS Word. Interestingly, when taking the same doc and saving it as a pdf, the correct page is entered in the TOC.

Any word on the date to release the pagination capability referred to in your post?

Hello!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing your experience.

That’s almost the same as what MS Word does. But Aspose.Words cannot update PAGEREF fields so you have to re-save the document with MS Word or use macros to refresh the fields.

When you export to PDF the intermediate XML also contains page references, not actual page numbers. Aspose.Pdf performs pagination and layouting so page numbers evaluation becomes available.

Currently that’s quite difficult to promise any release date for the pagination capability. We know it is very important but it is also very complex.

Regards,