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

Special char (&) is breaking word document #2615

Closed
2 tasks
rajpt opened this issue May 29, 2024 · 1 comment
Closed
2 tasks

Special char (&) is breaking word document #2615

rajpt opened this issue May 29, 2024 · 1 comment

Comments

@rajpt
Copy link

rajpt commented May 29, 2024

Describe the bug and add attachments

If there is "&" in the string it breaks the word document.
image

Expected behavior

It should not break.

Steps to reproduce

$phpWord = new PhpWord();

// Add a new section to the document
$section = $phpWord->addSection();

// Add text to the section
 $section->addText('this is H&M');

$wordFilePath = '/temp/myword.docx'

// Create a temporary file in memory
$objWriter = IOFactory::createWriter($phpWord);
$objWriter->save($wordFilePath);

Now if you try to open the file it throws an error. But if you remove '&' from about string then it works.

PHPWord version(s) where the bug happened

1.2

PHP version(s) where the bug happened

8.1

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)
@rajpt
Copy link
Author

rajpt commented May 29, 2024

Never mind this has been addressed here - #401

@rajpt rajpt closed this as completed May 29, 2024
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