Free Support Forum - aspose.com

TOC indices are warped

Hi.


We’re using ASPOSE.Words for .Net version 11.3

I did not want to wait to log this issue, because we’re just a few weeks away from a release. The reporting engine we’ve build on ASPOSE has been running smoothly for a year now, and this problem does not exist on the live environment. However, on dev, we discovered that the page numbers in the TOC is warped. (See the attached document. The page numbers are correct up to “Market Value(ZAR)”) We haven’t made any recent changes to the TOC, so this is very concerning. Any advice you can give us in resolving this issue will be highly appreciated.

More Information:
I found that if I remove the “Market Value(ZAR)” section, then the TOC renders correctly up to “Quarterly Fee Summary for the period …”. So, something in this section causes the TOC to count more pages than there really is. I’ll try using a process of elimination to see if I can find what element specifically causes this to happen.

Regards

Hi,


Thanks for your inquiry.

A Table Of Contents is simply represented by a TOC field; when you open, modify and then save a document, Aspose.Words does not update fields automatically, it keeps them intact. Therefore, you would usually want to call Document.UpdateFields method before saving if you have modified the document programmatically and want to make sure the proper (calculated) TOC field values appear in the saved document. Moreover, if you please open your document with Microsoft Word and Update the entire TOC using Update Fields option, you’ll observe that Aspose.Words does exactly the same as done by Microsoft Word.

If we can help you with anything else, please feel free to ask.

Best regards,

Hi Awais.


Actually this document was created from scratch using aspose, and we do use the Document.UpdateFields method to update the TOC. But it’s ok, as I see this is a known issue with our version of the Dll’s: Incorrect page numbers in the TOC

I’ll ask our teamleader to get the latest version of the dll. Sorry for starting another thread on this issue.

Hi,


Thanks for your inquiry. In your case, the latest version of Aspose.Words mimics the way the Microsoft Word updates TOC fields. Please let us know any time you have any further queries.

Best regards,