Forum


Replies: 5   Views: 3166
Addtemplatevarialble for headers
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 RamirezZ  · 11-04-2013 - 12:13

oke, I figured out why the template variables often not work with templates made with word2007 or 2010: for some reason, word often creats 3 header and footer files in stead of one. So we have in the word folder of the docx file three files for the header (header1.xml, header2.xml, header3.xml). And three for the footer. The problem is, that phpdocx only reads the first, called header1.xml.

There are two possible workarounds: The first one is, to simply copy the content of header2.xml and header3.xml to header1.xml in the template. I did not test this out, but it should work.

The other workaround (and I think this is the better): Rewrite the CreateDocx class and the CreateTemplate class, so that it reads all the header files instead of just header1.xml. The idea is to change the variable $_header from a string to an array storring strings and make the changes in the code accordingly. Its really not much you have to change. If anyone is interested in further details, I can post the changes I made. Of course only if the admins do not mind.