I'm using this library
Code example:
<?php
use \PhpOffice\PhpWord\PhpWord;
$phpWord = new PhpWord();
$section = $phpWord->addSection();
$section->addText('test');
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('Appdividend.docx');
return response()->download(public_path('Appdividend.docx'));
It works fine and returns docx file with "test" text, but when replace this row :
$section->addText('test');
with this one
$section->addText('<p>test</p>');
the docx document is empty.
CodePudding user response:
You can't just write the HTML formatted text into a DOCX field.