我正在尝试在 .docx 文档中进行替换
public function replace($seach, $replace)
{
$file = base_path() . '/public/templates/test.docx';
$phpword = new \PhpOffice\PhpWord\TemplateProcessor($file);
$phpword->setValue('%name%', 'Santosh');
$phpword->setValue('{lastname}', 'Achari');
$phpword->setValue('{name}', 'Achari');
$phpword->setValue('{officeAddress}', 'Yahoo');
$phpword->saveAs('edited.docx');
}
此代码替换 in { },但不替换 for%%
墨色风雨