Hello,
It seems your web server is returning a wrong mime type or it's adding some additional content to the DOCX. phpdocx is fully tested on Windows, Linux and macOS, and the createDocxAndDownload method uses a generic PHP code, but some configurations of web servers may require other code to download the documents.
On https://www.phpdocx.com/documentation/cookbook/download-generated-docx you can find an alternative code to download DOCX documents. This code may fix your error, but sometimes the problem comes from a framework that is adding header information (such as the topic https://www.phpdocx.com/en/forum/default/topic/1463) or any other external source (such as a CMS like Drupal).
We recommend you to test the library standalone, for example running the included samples using the createDocxAndDownload method, and do a search to get the source of your issue:
On this last page a user needed to do an exit; after the DOCX is downloaded to avoid adding extra information from his app.
As you are using a Premium license you can also test the stream mode to download the DOCX:
Sometimes we compare both DOCX (the document generated in the fs and the downloaded one) using a HEX viewer to find the source of the error. After doing the previous tests, if you still have the same proble, please send to contact[at]phpdocx.com the DOCX generated in the fs (download it using FTP if using a remote server) and the DOCX downloaded using a web browser.
Regards.