This project is read-only.

Using one template file for multiple pages???

Jan 1, 2013 at 11:42 PM


Is it possible to use one .docx file as a template for multiple pages in a document.

For example:

Create Document

For loop ( 1 to n )

Load template

Search & replace variables

End loop

Save&Download document

I'm trying to do this for records in database using foreach loop.

Thanks in advance.

Jan 9, 2013 at 9:41 PM

I have re-written the template code to do this very thing. When I am happy it works OK, then I will ask the developers if they would like to use it (if the have not developed the feature already).

At The moment it seems to deal the simple templates, which includes tables, headers and footers fine.

Jan 9, 2013 at 9:46 PM

It would be great if you could give me idea how to do it, or share code... I need this for my project where I would like to export multiple posts from my web app into one big Word file, each post on separate page... I'm currently using simple template, with some variables which get replaced before export.


Jan 9, 2013 at 10:11 PM

I have just uploaded it to the issue tracker. You will have to replace the template.php with it. It also includes some code to better detect the SetValue fields, but I believe there may be better out there.

Jan 11, 2014 at 10:35 AM
Dear Lloydie,

I have the problem to output several pages starting from a mysql select (something like SELECT * FROM TABLE).
I saw you faced the problem some time ago.
Are you so kind to teach me how and where place a SELECT ... within the template.php program and if you have a sample copy to send me of it.
I'm not a programmer and I have serious difficult to deal with tech things.
I'm stucked in this point from very long time and nobody is helping me.
Many thanks in advance.