Replies: 9   Views: 913
New section without "link to previous"
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 dev@ams  · 31-07-2020 - 12:29

Hi there,

When I add a section, the document contains the section with a "link to previoius" when I open it in Word. In Word, I am able to add section and toggle off the link to previous, so it can have separate footer, header, etc. Is it possible to toggle if this link using the addSection method? Preferably in html_extended.

Posted by admin  · 31-07-2020 - 17:39


Please check the documentation available on . To work with headers/footers per section, you need to work with standalone documents and merge them. You can generate those DOCX using PHP methods or HTML Extended.

Premium licenses allow generating the DOCX to be merged using in-memory DOCX instead of files.


Posted by dev@ams  · 03-08-2020 - 09:46


Thanks for your reply and suggestion. We have indeed a Premium license that would allow us to do so. However, this would require to design our process completely different.

We create the documents from template, and these templates do already contain the right sections. We have a section for the first page, and a new section starting from the section. This next one is not linked to the previous section, and contains a footer already. Is there a way to use this template, including its secionts, without having to merge docx files to achieve the same result? After all, the right information is in the template, but phpdocx seems to just not use it.

Posted by admin  · 03-08-2020 - 10:40


You can use any custom template, with one or more sections, to change the contents using phpdocx methods: template methods, DOCXPath and others. But if you need to generate new sections using addSection or phpdocx_section with their own header/footer, you need to work with standalone DOCX and merge them using mergeDocx, there's no alternative approach.


Posted by dev@ams  · 03-08-2020 - 11:03

So what's happening in my document:

I have a source docx that I use as tempalte with a certain page and a continuous page break, where the section on the following page is not linked to the previous. However, when I use this template to produce a document, phpdocx turns this section in a 'link with previous' section. which destroys the section from the template. I do not instruct phpdocx to add any sections. I'm looking for a way to prevent phpdocx from using this.

Posted by dev@ams  · 03-08-2020 - 11:23

Wat I further see: my template docx contains a footer1.xml, footer2.xml and footer3.xml. Those are all lost in the document generated with phpdocx.

Posted by admin  · 03-08-2020 - 11:49


What code are you running? template methods don't remove existing contents unless it's explicity requested. addHeader and addFooter methods remove existing headers and footers.

We have tested it loading a template with multiple sections and change the contents and it works correctly. If you send to contact[at] the most simple code and the template that illustrate your issue we'll check it.


Posted by dev@ams  · 03-08-2020 - 14:03

I think their may be indeed an override of the footer content that causes it to disappear. I will follow up on that with the dev team. If we come across any issues there, I will send it to the indicated email address. Anyway, I will share whether the results were positive.

Posted by dev@ams  · 05-08-2020 - 08:21

We've managed to use the footer from the template docx by disabling the addFooter method. The content from the footer int he section in the template docx is included in the docx generated using phpdocx. However, the lay-out is scrambled. The original footer contains text left-aligned, and a page number right aligned. Now they are both left aligned in the produced document. What could affect the mark-up?

Posted by admin  · 05-08-2020 - 08:31


Template methods don't remove/change existing contents unless it's explicity requested (or using DOCXPath, DOCXCustomizer or other classes that allow changing document contents and styles). As requested in our previous reply, please send to contact[at] the most simple code and the template that illustrate your issue and we'll check it (we need to run it, so the code can't use external resources such as databases or web services).