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?
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?
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.