Replies: 2   Views: 3378
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 marcushjortsberg  · 12-05-2014 - 11:19


I find an example where I can import styling options from a file for my TOC but I can't find an example where I can style my TOC without importing it from an external file...

I might bu stupid but I would like som help with this one:/


How do I style my TOC without importing it from an external file?




Posted by jorgelj  · 12-05-2014 - 12:27


This is the phpdoc of the method addTableContents:


     * Add a table of contents (TOC)


     * @access public

     * @example ../examples/easy/TableContents.php

     * @param array $options

     *  Values:

     * 'autoUpdate' (boolean) if true it will try to update the TOC when first opened

     * 'displayLevels' (string) must be of the form '1-3' where the first number is

     * the start level an the second the end level. If not defined all existing levels are shown

     * @param (array) $legend

     * Values:

     * 'pStyle' (string) Word style to be used. Run parseStyles() to check all available paragraph styles

     * 'b' (on, off)

     * 'color' (ffffff, ff0000...)

     * 'font' (Arial, Times New Roman...)

     * 'i' (on, off)

     * 'indent_left' 100...,

     * 'indent_right' 100...

     * 'jc' (both, center, distribute, left, right)

     * 'keepLines' (on, off) keep all paragraph lines on the same page

     * 'keepNext' (on, off) keep in the same page the current paragraph with next paragraph

     * 'lineSpacing' 120, 240 (standard), 480...,

     * 'pageBreakBefore' (on, off)

     * 'sz' (8, 9, 10, ...)

     * 'text' (string)

     * 'u' (none, dash, dotted, double, single, wave, words)

     * 'widowControl' (on, off)

     * 'wordWrap' (on, off)

     * @param (string) $stylesTOC path to the docx with the required styles for the Table of Contents


As you can see there're options to change color, align, size...