Forum


Replies: 2   Views: 2793
The open xml file xxx.docx cannot be opened
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 everrall  · 07-08-2019 - 09:46

Hello,
I have some problem with generating DOC file with png/jpeg images using phpdocx 9.0.
It looks like file has problems with formatting and can be opened in OpenOffice with formatting glitches.

https://monosnap.com/file/i82kkY6j49Gek3f4A8kqcCgzaqlQ9k

However, this file can't be opened in Microsoft Word and I've received following error: 

https://monosnap.com/file/umUVqr2zeYLtqqJVl5eMI1PwIuPFzw

"The Open XML file xxx.docx cannot be opened because there are problems with contents or the file name might contain invalid characters  (for example, /\). 
Details 

Attribute '%1' has an invalid value according to the DTD/ Schema. Location: 2"

Any help with this will be appreciated!

Posted by admin  · 07-08-2019 - 14:30

Hello,

That error appears when the DOCX includes some invalid tag or property, such as using negative values when a positive integer is needed. Please send the DOCX to contact[at]phpdocx.com and we'll check it.

Regards.

Posted by admin  · 08-08-2019 - 08:35

Hello,
 
The problem is that the document is using float values to set image sizes:
 
<wp:extent cx="4506235.2" cy="3117578.4"/>

<a:ext cx="4506235.2" cy="3117578.4"/>

And MS Word doesn't support them, you need to use positive integers.
 
phpdocx 9.5 will add an integer cast when adding images from HTML. If you want to apply the same change, you need to edit HTML2WordML.php and in the method getImageDimensions remove the return line and use:
 
return array((int)$cx, (int)$cy);

Regards.