Answer the question
In order to leave comments, you need to log in
How phpword add html data laravel 5.2?
Hi guys!
I use phpword in Laravel 5.2, I can't add html tags to word.
Below in the $about variable is the text with html tags, how to insert it so that word-e has the appropriate formatting
$section->addText("1. ".mb_strtoupper(trans('persons.general'), 'UTF-8'), $fontbold, $pStyle);
$section->addText('Анкета - '.$fio(), $fontbold, $pStyle);
//... тут куча кода
$word->addTableStyle('general', $styleTable);
$table = $section->addTable('general');
//... тут куча кода
$table3->addRow();
$table3->addCell(5000, $cellColSpan2)->addText('Обо мне'));
$table3->addCell(5000, $cellColSpan2)->addText(isset($about) ? $about : ""); //в переменной $about текст с html тегами
$responseName = ''.$id.'.doc';
$writer = IOFactory::createWriter($word, 'Word2007');
$writer->save($responseName);
return Response::download($responseName);
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question