Forum


Replies: 11   Views: 5099
Addtablecontents in a specific page
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 aldo.scrivanti@poch.cl  · 19-07-2016 - 20:19

Sorry but This not work for my I try to do exaclty that you say 

          $docx1 = new Phpdocx\Create\CreateDocx();
                $docx1->addText('Chapter 1', array('pStyle' => 'Heading1PHPDOCX'));
                $docx1->addText('Section', array('pStyle' => 'Heading2PHPDOCX'));
                $docx1->addText('Another TOC entry', array('pStyle' => 'Heading3PHPDOCX'));
                $docx1->createDocx('doc1');

                $docx2 = new Phpdocx\Create\CreateDocx();

                $legend = array('text' => 'Click here to update the TOC', 
                    'color' => 'B70000', 
                    'bold' => true, 
                    'fontSize' => 12);
                $docx2->addTableContents(array('autoUpdate' => false), $legend);

                $docx2->createDocx('indice');

                $docx3 = new Phpdocx\Create\CreateDocx();
                $docx3->addText('Chapter 2', array('pStyle' => 'Heading1PHPDOCX'));
                $docx3->addText('Section 2', array('pStyle' => 'Heading2PHPDOCX'));
                $docx3->addText('Another TOC entry 2', array('pStyle' => 'Heading3PHPDOCX'));
                $docx3->createDocx('doc2');


                $merge = new Phpdocx\Utilities\MultiMerge();

                $merge->mergeDocx('doc1.docx', array( 'indice.docx','doc2.docx'), 'example_merge_docx.docx', array('mergeType' => 1, 'numbering' => 'continue'));



                $docx = new Phpdocx\Create\CreateDocxFromTemplate('example_merge_docx.docx');
                $docxSettings = array('zoom'=>110);
                $docx->docxSettings($docxSettings);
                $docx->createDocx('example_final.docx');

But the tablecontent not update nothing is like the 3 docx was independence one of other  ... I need this work automatic not press f9 or another thing please