Skip to content

IOFactory::Load fails with "Cannot add Title in Header." #2616

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

Closed
2 tasks
WalidAxo opened this issue May 29, 2024 · 6 comments · Fixed by #2674
Closed
2 tasks

IOFactory::Load fails with "Cannot add Title in Header." #2616

WalidAxo opened this issue May 29, 2024 · 6 comments · Fixed by #2674

Comments

@WalidAxo
Copy link

Describe the bug and add attachments

Hi,
I'm trying to read a docx file with the following code :
$reader = IOFactory::createReader('Word2007');
$phpWord = $reader->load($copyFilePath);
$documentW = $phpWord->getSections();
I'm getting a bizarre behaviour from the "load" method saying ""Cannot add Title in Header."
I'm sure that my files is correct. I can open it on word, google doc, pages (macOS) and it's not corrupted.

I can't post the document here because it's confidential.
Capture d’écran 2024-05-29 à 11 07 40
Thank you for your help !
Best regards,

Expected behavior

The docx file should be loaded correctly. The error message is not clear on wha't wrong.

Steps to reproduce

I used the following code
$reader = IOFactory::createReader('Word2007');
$phpWord = $reader->load($copyFilePath);
$documentW = $phpWord->getSections();

PHPWord version(s) where the bug happened

1.2

PHP version(s) where the bug happened

8.0.30

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)
@Progi1984
Copy link
Member

@WalidAxo Hi, Could you give me a simple file, please ?

@Progi1984 Progi1984 added the Status: Waiting for feedback Question has been asked, waiting for response from PR author label Aug 8, 2024
@mishajib
Copy link

mishajib commented Sep 1, 2024

Does anyone give any feedback or solutions of this? I've also faced this same problem.

here is my code example:

$phpWord = IOFactory::load($filePath);

@Progi1984
Copy link
Member

@mishajib Hi, Could you give me a sample file, please ?

@mishajib
Copy link

mishajib commented Sep 2, 2024

@mishajib Hi, Could you give me a sample file, please ?

sample 1 - Parsable file.docx

here is the sample file. @Progi1984

Thanks

@Progi1984 Progi1984 added this to the 1.3.1 milestone Sep 2, 2024
@Progi1984 Progi1984 added Open XML (Word 2007+) and removed Status: Waiting for feedback Question has been asked, waiting for response from PR author labels Sep 2, 2024
@Progi1984
Copy link
Member

The PR #2674 fix the problem. @SpraxDev is on the way. Thanks to him.

@Progi1984 Progi1984 linked a pull request Jan 22, 2025 that will close this issue
4 tasks
@Progi1984
Copy link
Member

Fixed by @SpraxDev in #2674.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants