Skip to content
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

Docx generated from template corrupted with LibreOffice 24 #2709

Open
2 tasks
clairenollet opened this issue Nov 29, 2024 · 0 comments
Open
2 tasks

Docx generated from template corrupted with LibreOffice 24 #2709

clairenollet opened this issue Nov 29, 2024 · 0 comments

Comments

@clairenollet
Copy link

clairenollet commented Nov 29, 2024

Describe the bug and add attachments

Hello and thank you for creating and maintaining this library !
I face a problem with docx generated from template using PHPWord : it opens correctly with LibreOffice 7, but is considered corrupted with LibreOffice 24.

🔴 LibreOffice 24 version details :

Version: 24.8.3.2 (X86_64) / LibreOffice Community
Build ID: 48a6bac9e7e268aeb4c3483fcf825c94556d9f92
CPU threads: 20; OS: Windows 11 X86_64 (10.0 build 22631); UI render: Skia/Vulkan; VCL: win
Locale: fr-FR (fr_FR); UI: fr-FR
Calc: CL threaded

✅ LibreOffice 7 version details :

Version: 7.3.7.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Ubuntu package version: 1:7.3.7-0ubuntu0.22.04.7
Calc: threaded

Expected behavior

I expect a docx generated from a template using PHPWord to be properly formatted for LibreOffice >=24.

Steps to reproduce

  • create a simple docx template, for example containing only the paragraph Hello ${toto} !
  • process this template and set a value for toto : $templateProcessor->setValue('toto', 'titi');
  • save processed template as docx and send it in the BinaryFileResponse of your endpoint
  • open the downloaded docx with LibreOffice 24 : the file is corrupted, var are not translated (file still contains Hello ${toto} !)
  • open the downloaded docx with LibreOffice 7 : the file opens correctly, var are translated (file contains Hello titi !)

I have also noticed that if you open the file with LibreOffice 7, save it, and then open it with LibreOffice 24, the file will display correctly.
LibreOffice 7 seem to fix the file.
If you change the file extension into zip and search for differences between a never opened file and a saved with LibreOffice 7 file, you will notice several changes, particularly in the word/document.xml.

PHPWord version(s) where the bug happened

1.3.0

PHP version(s) where the bug happened

8.2

Priority

  • I want to crowdfund the bug fix (with @algora-io) and fund a community developer.
  • I want to pay the bug fix and fund a maintainer for that. (Contact @Progi1984)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant