TOC is not updated when the content is changed

We are using aspose.word for java to manipulate the word document. However when we remove certain pages ,the TOC is not getting updated based on the latest update.

Attached is the sample document generated from aspose, we remove the content using
node.remove()

Please guide us.

This got resolved after calling

document.updateFields();
document.updatePageLayout();

Hi Pradeep,


Thanks for your inquiry. It is nice to hear from you that your issue has been resolved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.