Open technilogics opened 4 months ago
I also encountered a similar problem, and I haven't been able to solve it yet.
my way to solve it:
override PHPWord/src/PhpWord/TemplateProcessor.php in composer.json
and replace
return $subject ? Text::toUTF8($subject) : '';
>>> return (null !== $subject) ? Text::toUTF8($subject) : '';
Thanks @truestealth - works great!
As a workaround, you could prepend the 0
with a zero width no-break space:
$templateProcessor->setValue('test', mb_chr(hexdec('FEFF')) . '0');
https://github.com/PHPOffice/PHPWord/blob/8b891bb6842dd383f679b47898fad0b7c181f325/src/PhpWord/TemplateProcessor.php#L272
return $subject ? Text::toUTF8($subject) : '';
Cause issue if subject is 0, that actually i want to print, but unfortunately when $subject=0 as string or int or char it results in false.
Please fix this issue