Forum


Replies: 6   Views: 3614
Addtemplate to each 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 peter  · 30-10-2012 - 11:17

Hi

i'm trying to create a document which will have more than one page.

to each page I've want to use the same template

something like this: (pseudocode)

$docx = new createdocx();

while(....){
$docx->addtemplate(....)
.
.
.
last in the while loop:
$docx -> addBreak('page');
}

I tried different ways and one way was to addtemplate outside the loop.

This doesn't work; it only creates the first page.

So to make sure that the pages was correctly created I redid the loop and created seperated files for each page and they are correct created.

since I was sitting with all these files with one page each I decided to see if you had a merge function which you had. so using the example from your site I tried to merge two docx files but that ends up with two pages where the second page is empty.

This might be due to the fact (reported in another thread) that there are two undeclared vars in merge function.


My question is simply how to make this work, the creating of seperated files for each page and then merge the files simply doesn't appeal me, seems very bad way to solve this especially since it's going to be used a lot each day.

edit: version 2.6 Pro+
/Peter