Description
Describe the bug and add attachments
Hi everyone,
I'm using the setValue() function to remove some lines containing specific template variables by passing an empty string as the value.
However, this doesn't completely remove the line, leaving a blank space.
For exemple, if my template has a line like this :
${my_var}
And I use setValue('my_var', "");
, I still get an empty line even when the line solely concist of the template variable.
Expected behavior
I expected the entire line to be removed, as it only contained the template variable.
Is there something I need to do differently to completely remove a specific line ?
Steps to reproduce
1 - Insert a template variable (e.g., ${variable}) in the document. Ensure this variable is the only content on its line, with no other text or elements present on that line.
2 - Use the setValue() method to set the variable to an empty string: $templateProcessor->setValue('variable', '');
3 - Save the output as a new document (e.g., output.docx) using $templateProcessor->saveAs('output.docx');
4 - Observe the output. You'll notice that an empty line remains where the template variable was located.
PHPWord version(s) where the bug happened
1.3.0
PHP version(s) where the bug happened
8.4
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)