PHP操作word 使用 TemplateProcessor 使用 .docx 文件中添加图像
原创废话不说,直接上码:
//在你的 templatefile.docx 中必须有一个文本 ${foto} 才能工作
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('templatefile.docx');
$templateProcessor->setImageValue('foto', array('path' => 'dummy_foto.jpg', 'width' => 100, 'height' => 100, 'ratio' => true));
$templateProcessor->saveAs('result.docx');
//打开文件
header("Content-disposition: attachment;filename=" .'result.docx' . " ; charset=iso-8859-1");
echo file_get_contents('result.docx'); 版权声明
所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除
上一篇:MongoDB简介及CRUD操作 下一篇:MySQL如何查询表结构及列注释
itfan123


