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.
Hello,
If you're createing a new document the code is simple; for example:
//path to the CreateDocx class within your PHPDocX installation
require_once '../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$docx->addText('Cover');
$docx->addBreak(array('type' => 'page'));
$docx->addText('Another page');
$docx->addBreak(array('type' => 'page'));
$docx->addTableContents(array('autoUpdate' => true), $legend, '../../examples/files/crazyTOC.docx');
//we add now some headings so tehy show up in the TOC
$docx->addText('Chapter 1', array('pStyle' => 'Heading1PHPDOCX'));
$docx->addText('Section', array('pStyle' => 'Heading2PHPDOCX'));
$docx->addText('Another TOC entry', array('pStyle' => 'Heading3PHPDOCX'));
$docx->createDocx('example_addTableContents');
If you're using templates you need to add the TOC with Word in the page you need it. You can't replace a placeholder by a TOC.
Regards.