Replies: 4   Views: 2012
Word error while oppening generated document
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 mracer164  · 19-09-2017 - 10:57

Hello, when I document from the template and try to open it with Word it gives me and error that it was unable to ope the document. when I click ok everything opens up correctly. I've already commented ou all of my code and when generating document only from the template (onlyy the 


function is called before generating the document nothing else) the proble still exists. I assume that it is caused by the template I'm using. Where can I send my template to be examined for potential issues?

Thanks in advance.

Edit: Previously documents were generating without errors so it could be problem bym server's configuration. I've recently started using XDEBUG on my server could it be the casuse? That would be strange because the XDEBUG module has been installed on mys erver for a long time I jus wasn't using it. Also I've tried restarting my server and closing NetBeans and all debugging sessions altogether. Could it be that XDEBUG session messed with my phpdocx installation? I'm ussing the trial version at the moment.

Posted by admin  · 19-09-2017 - 11:41


Please read this topic of a user with a similar issue:

maybe your problem is the same.

We recommend you to run and test the samples in the package. and try using PHP CLI mode running the included samples standalone to find the source of the problem. Maybe your server is adding extra strings to the DOCX files when downloading or generating it.

About sending a custom template, sorry but the trial package doesn't include support for this. After you have purchased a license please contact as again and we'll check it.


Posted by mracer164  · 19-09-2017 - 11:54

Thank you for the response. I've tried solutions suggested in the topic that ou linked and the document isn't corrupetd if I download generated file using ftp but whe I use function 


automatically downlaoded file gets corrupted. I am aware that it is most likely proble with my server's configuration but are there any suggestions from your side regading this kind of problem? Thanks.

Posted by mracer164  · 19-09-2017 - 13:02

I've inspected both documents (one downloaded from ftp and one downloaded through the browser) and the only difference between them is that the uncorrupted one has two additiona null bytes at the end of file while the corrupted one has those two additional bytes at the beggining but not at the end. I'll examine the behaviour while using alernative generate and download method you mentioned but it seems odd to me, especially that it used to work flawlessly before.