Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Accept a POST request with the text that the user entered into the editor and save it to a file.
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// Добавим секцию (в Word весь текст разделен на секции)
$section = $phpWord->addSection();
// Добавим наш HTML в секцию
$html = $_POST['content'] ?? '';
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html, false, false);
// Сохраняем файл
$phpWord->save("html-to-doc.docx", "Word2007");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question