Forum


Replies: 16   Views: 4357
Header and footer not showing
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-12-2017 - 16:20

Hello,

If you are using a template and then you need to add new content with headers and footers created from scratch, we recommend you to use the generate each DOCX standalone and the use the mergeDocx method:

1. Replace the contents of the template (this is the cover).

2. Create a new DOCX with the new contents, headers, footers.

3. Merge both DOCX using the mergeDOCX method (https://www.phpdocx.com/api-documentation/docxutilities/merge-Word-documents-with-PHP).

There's also an article about this approach (https://www.phpdocx.com/documentation/cookbook/headers-and-footers-for-sections). The addHeader and addFooter methods should only be used for DOCX created from scratch.

Or you could create a single template with the cover and a new page with a placeholder image for the headers and footers.

Regards.