Forum


Replies: 3   Views: 2328
How can i add a table of contents to a specific point in a docx created by a template?
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 afantini  · 26-04-2018 - 08:38

The document is generated by a template.The PHP script basically replaces a large number of variables - either using the replaceVariableByText () function or the replaceVariableByExternalFile () function - and eventually deletes some blocks.
I would like to avoid having to put the table of contents at the bottom of the document, as I currently did:

$ docx-> addTableContents (array ('autoUpdate' => true), $ legend);
$ Docx-> clearBlocks ();
$ docx-> createDocx ('./ test / offer'. $ variables ['VAR_OFFER_NUMBER']);


For me it would be ideal to insert the table of contents on the second page, but taking the first from the template.I hope I was able to explain: I would not, if possible, have to do the first page "line by line" from PHP.