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.
I would like to use the template function in order to make life easier for my end users. However, as soon as I start using addTemplate('path/template.docx') the following warnings show up:
Warning: ZipArchive::addFile() [ziparchive.addfile]: Invalid or unitialized Zip object in /var/www/view_extensions/php_docx/v2.6_pro/classes/CreateDocx.inc on line 6148
Warning: ZipArchive::close() [ziparchive.close]: Invalid or unitialized Zip object in /var/www/view_extensions/php_docx/v2.6_pro/classes/CreateDocx.inc on line 4314
The files itself get created and seem to be OK (no error when opening them etc).
Any help would be appreciated.
You need to enable Zip extension in your php.ini file and restart web server.
zip is activated and works fine - the messages only show up when I use the "addTemplate" function. If I just create docx files everything is working as expected.
Seems your DOCX is not a valid ZIP file. Please contact us and send your docx file to test it.
I use a very basic docx file in the meanwhile which only contains the names of the var's. That should not be the issue... Howerver, I have uploaded the document for your inspection: http://www.security-blog.eu/wp-content/uploads/2012/09/temp.docx
Furthermore, the first document in the loop is getting created just as it should and based on the (basic or complex) template.