We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Update Table of Contents not performing correctly.

Hi,

I'm currently trying to update the table of contents in a document so that the page numbers are updated. The table of contents are initially part of a document that is being merged with other documents.

Once all the documents are merged together, I call the update table of contents method.

However, once I generate the final document, the table of contents has been replaced by the string "TOC".

I've tried looking for an answer as to what is happening but haven't had any luck.

Kind regards

Craig


3 Replies 1 reply marked as answer

SB Suriya Balamurugan Syncfusion Team October 12, 2022 06:28 AM

Hi Craig,

We have tried to reproduce the reported problem using the given details, but it works properly at our end. For your reference, we have attached the sample application which we tried to reproduce the reported problem at our end, and it can be downloaded from the below attachment.

Note: Please find the input Word document in the “Data” folder of the attached sample application.

Could you please try the attached sample application at your end and provide us confirmation whether you are facing issues in this sample.

If the issue is not reproduced using the attached sample application at your end, then could you please modify the attached sample as an issue reproducible sample application and share us. Thereby, we will proceed further to replicate the same problem at our end and will provide you appropriate solution at the earliest.

Regards,
Suriya Balamurugan.


Attachment: DocIOExample_491b7ee6.zip


CB Craig Bronsdon October 14, 2022 07:22 AM

Hi again,


I've been doing some research alongside your example (which works fine on my end).


The issue appears to be stemming from the page numbers in the footers of my .docx files.

I removed them and the Table of Contents updates correctly.


I'm going to be doing more testing today and will update this post when I have a solution.


Regards,

Craig




CB Craig Bronsdon October 20, 2022 07:12 AM

This issue is now resolved.

The solution was to ensure that page numbers are formatted correctly within a document.

In my case, I imported all documents together and then wrote the footer myself programmatically, including page numbers.

I then updated the table of contents and everything worked fine.


Marked as answer
Loader.
Live Chat Icon For mobile
Up arrow icon