document.updateFields is having impact in performance

document.updateFields is taking more time and it is having impact in performance. for 1.3MB file it is taking 2.5 mins time is taking for updateFields method and without using this method table of contents is not populating in downloaded document. Do we have any other alternative to populate table of contents without using document.updateFields
Note: am using 23.11 aspose version

@saranya17 To update table of content it is required to build document layout, depending on the document size and complexity the operation might be quite time consuming. There is no way to update TOC without calling Document.updateFields. Please see our documentation for more information:
https://docs.aspose.com/words/java/working-with-table-of-contents/#update-table-of-contents

You can attach your document here for testing. We will check it on our side and provide you more information.

am not trying to update the table of contents …i want to insert the table of contents

@saranya17 Anyways after inserting table of contents it is required to update it otherwise it will not be shown in the output document and the end user will have to update it in MS Word manually.