[英]PHP word not replace text in doc
我正在尝试在.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');
}
此代码替换为{ }
,但不能替换为%%
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.