I am using a PHPWord library for my project.
I have an existing docx file template with some data and layout: I need to replace certain values in the file and create a new docx file.
The default replace placeholder for PHPWord is ${replaceword}
, I need to change it to {{replaceword}}
in docx file template.
Is it possible to achieve from this snippet?
include 'vendor/autoload.php';
$templateProcessor = new \PhpOffice\PhpWor\TemplateProcessor('sample.docx');
$templateProcessor->setValue('name','John');
$templateProcessor->saveAs('new.docx');