Replies: 2   Views: 3143
Editing word template causes variables to fail in table
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 ephp027  · 12-09-2012 - 22:50

This has been discussed on the forum before but I did not see an easy solution. My solution before.

1. You create Word template with $variables$, run your phpdocx script, everything is great.
2. Now you want to change your variable names or something, so you edit and save your Word template
3. Now you run your phpdocx script again but the variables are not acting right!!

Cause: When you edit and save, Word saves barf in your file.

1. From inside Word, save your Word template to odt format.
2. Close all files.
3. Reopen odt file, save as docx.

(You have to do it EVER time you edit your Word template.)

Word 2007
Windows XP
php 5.4.5
apache 2.4
phpdocx Pro 2.6

Posted by mbcalvin  · 11-04-2013 - 12:13

I have Word 2010 and PHPDOCX Pro 2.6. For this trick to work for me, I had to save as an RTF file, not OTD. Otherwise, it seems to have worked.

Thanks for a solid post.