$source = __DIR__. "/html-to-doc.docx";
$objReader = \PhpOffice\PhpWord\IOFactory::createReader('Word2007');
/** @var \PhpOffice\PhpWord\PhpWord $phpWord */
$phpWord = $objReader->load($source);
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'HTML');
$objWriter->save('test.html');
$source = __DIR__. "/html-to-doc.docx";
$objReader = \PhpOffice\PhpWord\IOFactory::createReader('Word2007');
/** @var \PhpOffice\PhpWord\PhpWord $phpWord */
$phpWord = $objReader->load($source);
foreach($phpWord->getSections() as $section) {
foreach($section->getElements() as $element) {
if(method_exists($element,'getText')) {
echo($element->getText() . "<br>");
}
}
}
SELECT * FROM `sentences` WHERE ('Сюда вставить какой-то большой текст' REGEXP regular_expression)
<?php
include (__DIR__ . '/vendor/autoload.php');
if (!empty($_POST)) {
$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");
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CKEditor</title>
<script src="https://cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
</head>
<body>
<form method="post">
<textarea name="content"></textarea>
<input type="submit" value="OK" />
</form>
<script>
CKEDITOR.replace( 'content' );
</script>
</body>
</html>
$html = $_POST['content'] ?? '';
$html = !empty($_POST['content']) ? $_POST['content'] : '';
не понятно, что вы хотите.