PHPWord changing default pattern

时间:2019-04-08 12:54:22

标签: php phpword

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');

0 个答案:

没有答案