Forum


Replies: 2   Views: 4094
Replacing image placeholders in template creates corrupt 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 arcmedia  · 09-03-2015 - 14:56

Hello, We're having an issue where replacing image placeholders in template generates a corrupted document. MS Word Error message is as follows: "We're sorry. We can't open document_name because we found a problem with its contents. Details: The file is corrupt and cannot be opened". When hitting OK, I get: "Word found unreadable content in document_name. Do you want to recover the contents of this document?". Hitting "Yes" seems to recover a well formed document. A dialog appears with a list of repairs, all being "Sections and Headers". Thanks in advance.

Posted by admin  · 09-03-2015 - 15:01

Hello, Please post or send a simple script that replicate the issue. The message you post is a generic error from Word, and we can't guess what's wrong. And please run the example replaceVariableByWordFragment/sample_1.php to check if the library is working fine on your server. Regards.

Posted by arcmedia  · 19-03-2015 - 10:18

The problem was, that the filename contained a dot. So any image with a "." in the name would generate a corrupted word file.