Forum


Replies: 3   Views: 2987
Toc update before save?
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 admin  · 19-05-2017 - 14:57

Hello,

A content appears in the TOC if it has an outlineLvl tag and its value is in the range of the allowed values by the TOC. Maybe your paragraph styles Heading1 and Heading1Line don't include that tag (a name such as Heading doesn't create automatically an outlineLvl tag); internally, in OOXML, a heading style is a style with an outlineLvl tag. Phpdocx includes heading styles you can use:

https://www.phpdocx.com/api-documentation/word-content/insert-heading-Word-document-with-PHP

an options to set heading levels dynamically (headingLevel):

https://www.phpdocx.com/api-documentation/word-content/add-paragraph-text-Word-document-with-PHP

This is explained on https://www.phpdocx.com/documentation/cookbook/tables-of-contents (Adding items to the TOC section). We recommend you to read the documentation available on this page step by step and the example Core/addTableContents to understand how to use a TOC.

You can add contents to the TOC using a template or creating the document from scratch.

Regards.