Forum


Replies: 1   Views: 1868
Update pre-existing tocs
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by royh  · 29-11-2019 - 14:04

I have a pre-existing TOC in a DOCX which I want to update. I see there are examples of adding a TOC with autoUpdate but how do I update an existing TOC before saving?

Posted by admin  · 29-11-2019 - 17:14

Hello,

If you want to use the same approach of the addTableContents method, you can set the updateFields option as true using the docxSettings method. This option request auto-updating the TOC when opening the DOCX.

If you need to update the TOC without opening it, you can use the conversion plugin based on LibreOffice (please check the docs folder included in the package). phpdocx 9.5 also includes an option to generate TOC using the conversion plugin based on MS Word.

Regards.