How to remove Table Of Contents (TOC) from a Word document?

I am trying to remove the Table of Contents (TOC) from a Word Document using DocIO but have so far been unable to figure out how to do this. Can anyone point me in the right direction?

TIA

Nic

3 Replies

VR Vijay Ramachandran Syncfusion Team March 30, 2018 06:34 AM UTC

Hi Nic,

Thank you for using Syncfusion products.

We have prepared sample to remove the Table of Contents from Word document. Please find the sample from below link and let us know if it helps.
http://www.syncfusion.com/downloads/support/forum/136738/ze/Remove_TOC-1871509599.zip

In the above sample, we have done the following things.

      1. Opened existing Word document which contains Table of Contents.
      2. Finds the TOC instance by iterating Word document elements.
      3. Inserted the bookmark start at the beginning of TOC field.
      4. Finds the last item of TOC field and inserted the bookmark end after the last TOC item.
      5. Removed all the TOC field items by using BookmarkNavigator functionality.
      6. Finally, saved the resultant Word document.

Please let us know if you have any questions.

Regards,
Vijay R
 



NA Nic Adams April 3, 2018 08:46 AM UTC

Thanks Vijay - works perfectly.

Nic


MJ Mohanaselvam Jothi Syncfusion Team April 4, 2018 05:13 AM UTC

Hi Nic,

You are welcome.
We are glad to know that our solution has resolved your requirement.


P
lease get back to us if you need any other assistance. We will be happy to assist you as always.

Regards,
Mohanaselvam J
 


Loader.
Up arrow icon