-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
templateProcessor saveAs is generate corrupt file #2083
Comments
FYI, I have the same issue fixed not using the saveAs function patched for windows
to this that uses rename
|
@mattimatti i already found out the problem. Its because some of the content of the docx cannot be translated, for example; a very complex table with lots of layout and etc. If you can test a very simple docx vs a complex docx ( with image) you can see the difference |
I have the same problem using the Template Processor. Settings::loadConfig();
The saved document is corrupted. When I download it from the hosted server, Word says it's corrupted, when repaired, it has none of the field tags replaced. |
I faced similar problem when PhpWord saved files, but they were corrupted. There is a dedicated section to the discussed problem: "Output escaping", which says: After I enabled built-in PhpWord output escaping my problem seems to be solved. |
It seems the the problem is related to the ZIP library. When I comment out the following: //Settings::setZipClass(Settings::PCLZIP); It now works. This doesn't explain why it worked for 14 months using the recommended setting, and stopped suddenly on October 4, but it works now without this setting. |
Anyone can help ? |
see #2613 (comment) |
Describe the Bug
When i try to load the template docx thru TemplateProcessor and save as a new file , it will generate a corrupt file , like this
All i did is just to save it to new file.
Steps to Reproduce
Please provide a code sample that reproduces the issue.
Test Case 1
Test Case 2
Expected Behavior
Ive try a bunch of fixes like :
htmlspecialchars
set \PhpOffice\PhpWord\Settings::setZipClass(\PhpOffice\PhpWord\Settings::ZIPARCHIVE);
set \PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(true);
file permission
and many more
PHP Version: 7.3
PHPWord Version: 0.18.1 latest version
The text was updated successfully, but these errors were encountered: