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

Hello,

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 (http://www.phpdocx.com/api-documentation/layout-and-general/add-section-Word-document-with-PHP) or do a page break (http://www.phpdocx.com/api-documentation/word-content/insert-line-column-page-break-Word-document-with-PHP).

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 (http://www.phpdocx.com/api-documentation/docxutilities/merge-Word-documents-with-PHP)

Regards.