I have problem with rendering HTML tags when load template. I use HTMLtoOpenXML to render it, but in the end it is just plain code. I use this:
$workDescription = $entity->getWorkDescription(); $workDescription = \HTMLtoOpenXML::getInstance()->fromHTML(str_replace("<br />","<br>", stripslashes($workDescription))); $workDescription = $this->replaceSpecialChar($workDescription); $phpWord = new \PhpOffice\PhpWord\PhpWord(); $document = $phpWord->loadTemplate($templatePath); $document->setValue('Description', $workDescription); $document->saveAs($file);
And PhpWord load document, and set description from variable, but output is something like this in rendered document:
<w:p> <w:pPr> <w:pStyle w:val='OurStyle2'/> </w:pPr> <w:r> <w:t xml:space='preserve'> Test of CK Editor tags to transform them to word, </w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val='OurStyle2'/> </w:pPr> <w:r> <w:t xml:space='preserve'> With a paragraph </w:t> </w:r> </w:p>
If I do not use HTMLtoOpenXML I get:
<p>Test of CK Editor tags to transform them to word,</p> <p>With a paragraph</p>
So this looks like I'm missing something. Any help?