问题描述
我下载了 PHPWord 库,到目前为止我对结果非常满意 - 除非我无法正确地保存文档 - 它确实保存了文档,但它是空的。 >
这是我的代码:
preg_match_all("/\.(?!.*\.)(.+)/",$word_document,$mime);
$mime = $mime[0][0]; // contains ".docx" Now
$templateProcessor = new \PHPOffice\PHPWord\TemplateProcessor($word_document);
// $word_document contains the absolute path to the doc
$templateProcessor->setValue('PLACEHOLDER','Doe');
// ${PLACEHOLDER} in doc is replaced with "Doe"
var_dump($templateProcessor);
/* returns,among others,["tempDocumentMainPart":protected]=>
string(836) "Behördenvollmacht für Doe" -> you can see that 'Doe' is Now contained in the
document. */
$templateProcessor->saveAs($path.$new_doc_name.$mime); // saves the document but its empty
为什么这不能正常工作的任何提示或想法?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)