Я пытаюсь скрыть HTML, отформатированный с помощью слова Php.
Я создал HTML-форму с помощью summernote. Summernote позволяет пользователю форматировать текст. Этот текст сохраняется в базе данных с помощью тегов html.
Затем, используя phpWord, я хотел бы вывести захваченную информацию в текстовый документ. Пожалуйста, посмотрите код ниже:
$rational = DB::table('rationals')->where('qualificationheader_id',$qualId)->value('rational');
$wordTest = new \PhpOffice\PhpWord\PhpWord();
$newSection = $wordTest->addSection();
$newSection->getStyle()->setPageNumberingStart(1);
\PhpOffice\PhpWord\Shared\Html::addHtml($newSection,$rational);
$footer = $newSection->addFooter();
$footer->addText($curriculum->curriculum_code.'-'.$curriculum->curriculum_title);
$objectWriter = \PhpOffice\PhpWord\IOFactory::createWriter($wordTest,'Word2007');
try {
$objectWriter->save(storage_path($curriculum->curriculum_code.'-'.$curriculum->curriculum_title.'.docx'));
} catch (Exception $e) {
}
return response()->download(storage_path($curriculum->curriculum_code.'-'.$curriculum->curriculum_title.'.docx'));
Текст, сохраненный в базе данных, выглядит так:
<p class = "MsoNormal"><span lang = "EN-GB" style = "background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style = "font-family: Arial;">The want for this qualification originated from the energy crisis in
South Africa in 2008 together with the fact that no existing qualifications
currently focuses on energy efficiency as one of the primary solutions. </span><span style = "font-family: Arial;">The fact that energy supply remains under
severe pressure demands the development of skills sets that can deliver the
necessary solutions.</span><span style = "font-family: Arial;"> </span><o:p></o:p></span></p><p class = "MsoNormal"><span lang = "EN-GB" style = "background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Arial;">This qualification addresses the need from Industry to acquire credible
and certified professionals with specialised skill sets in the energy
efficiency field. The need for this skill set has been confirmed as a global
requirement in few of the International commitment to the reduction of carbon
Я получаю сообщение об ошибке ниже:
ErrorException (E_WARNING) DOMDocument::loadXML(): Namespace prefix o on p is not defined in Entity, line: 1





