мне не удалось изменить текст, он загружается "заполненная" форма, но Placeholder_text не меняется
Код: Выделить всё
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once 'vendor/autoload.php';
use PhpOffice\PhpWord\TemplateProcessor;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Get the selected option from the form
$selectedOption = $_POST['selected_option'];
echo "Selected Option: " . htmlspecialchars($selectedOption);
// Load the template document
$templateProcessor = new TemplateProcessor('ver.docx');
// Replace the placeholder text with the selected option
$templateProcessor->setValue('placeholder_text', $selectedOption);
// Save the modified document
$templateProcessor->saveAs('VEREDICTO.docx');
// Download the file
header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
header('Content-Disposition: attachment; filename="VEREDICTO.docx"');
readfile('VEREDICTO.docx');
exit;
} else {
echo "Invalid request method.";
}
Код: Выделить всё
$templateProcessor->setValue('placeholder_text', $selectedOption);
Подробнее здесь: https://stackoverflow.com/questions/792 ... le-via-php