How to Obtain Automatic Updation of TOC in Word- whenever contents are updated/deleted?

Hi

I am using necessary Codes for TOC for my contents in the Document. And I am getting proper TOC for all the contents I am including in the document as well.

But the problem arises when I delete any particular content of the document, as per my necessity. but the TOC does not seem to get updated accordingly. It also shows the deleted content headings , whereas they should not be present in the TOC(because they are deleted).

What should i do to make the TOC dynamic?

Thanks & Regards

Anu

Hi Anu,


Thanks for your inquiry. In Microsoft Word, fields are not automatically updated when a document is opened, but you can update fields in a document at any time by pressing F9. Similarly, in Aspose.Words, you can simply call Document.UpdateFields method to update the values of fields (including TOC field) in the whole document. I hope, this helps.

Best regards,