Replies: 6   Views: 2020
Page number when merging with multiple templates
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 neu_katayama  · 16-08-2019 - 08:48

Is it possible to merge multiple templates and set the page number in the middle?

fileA: non page number (2page)
fileB: page number (3page)
fileC: page numer (2page)

1page : page number none (fileA)
2page : page number none (fileA)
3page : page number 1 (fileB)
4page : page number 2 (fileB)
5page : page number 3 (fileB)
6page : page number 4 (fileC)
7page : page number 5 (fileC)


Posted by admin  · 16-08-2019 - 11:31


Yes, you just need to merge second and third DOCX and then merge the output with the first DOCX. The mergeDocx method includes the numbering option to manage page numberings (continue and restart values are available).

As you are using a Premium license you can use in-memory DOCX to get the best performance.


Posted by neu_katayama  · 19-08-2019 - 02:35


I use a premium license.

What is the specific source code for how to merge what was merged in memory?

Posted by admin  · 19-08-2019 - 06:06


We recommend you to check the sample DocxUtilities/mergeDocx/sample_2.php included in the Premium package that illustrates how to use in-memory DOCX with mergeDocx.


Posted by neu_katayama  · 19-08-2019 - 08:42

Is it possible to run mergeDocx itself in-memory?
Perform the process of merging the merged again.

I know how to merge what was created in-memory.

Thank you.

Posted by admin  · 19-08-2019 - 08:54


The next version of phpdocx will allow returning a in-memory DOCX when using mergeDocx. phpdocx 9.0 doesn't include support.

Users with an active LUS ( can download beta releases and features not yet available in the stable package. If you purchase the LUS to your license (on MY PHPDOCX page after login) you can write to contact[at] and the dev team will send you the new class that include support for returning in-memory DOCX in mergeDocx and a sample that illustrates how to use it.


Posted by neu_katayama  · 20-08-2019 - 01:00

In memory, mergeDocx can be used from the next version.

This time, create the file once and then merge it.

Thank you very much.