Replies: 11   Views: 4963
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 admin  · 19-07-2016 - 16:04


Our apologies for misunderstanding. You can't add a TOC in your template and then use addTableContents to add a TOC. If you do this, you're adding two TOCs. We asked you to add a TOC to your template, but without using the method addTableContents (this method adds other TOC keeping any other existing TOCs).

Word isn't like a PDF (it's more like HTML), and you don't know where a content will be or how many pages fill until you 'paint' (open) the document.

About adding content to new pages and not immediately after the existing content, you should create a new section ( or do a page break (

Please follow these steps to acomplish what you need:

1. Create the first and second pages standalone in a DOCX (using phpdocx or Word).

2. Create the table of content using addTableContents in another DOCX.

3. Create the other contents of the document in another DOCX.

4. Merge all DOCX using mergeDocx (