hi is there a method to find a specific string and replace it using PHPWord ?
yes, the method is called setValue
e.g
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($fileName);
$templateProcessor->setValue('year', date('Y'));
$templateProcessor->saveAs($newFileName);
year has to be mentioned like
${year} in your Word Doc.
I hope this helps
You should refer to the documentation in regards to queries like this. If you find a bug, you should report it here.
Most helpful comment
yes, the method is called
setValuee.g
year has to be mentioned like
${year} in your Word Doc.
I hope this helps
You should refer to the documentation in regards to queries like this. If you find a bug, you should report it here.