Forum


Replies: 3   Views: 2317
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.

Posted by admin  · 26-04-2018 - 08:53

Hello,

Since phpdocx 8, addTableContents can be used as WordFragments.

To accomplish what you need, we recommend you using phpdocx 8 and DOCXPath. DOCXPath is available in Advanced and Premium licenses.

What license and version of phpdocx are you using?.

Regards.

Posted by afantini  · 26-04-2018 - 09:23

Hello,

I have been commissioned by my company to test phpdocx to see if it fits our needs and determine which version to buy: I am currently using the trial.

Best regards.