2

我对 PHPWord 中的 setValue() 函数有疑问。通常,参数应该是纯文本变量,但在这种情况下,我必须处理一个 html 块。并且 PHPWord 无法将 html 标签解析为 word xml。

我的意思是替换这个html: 在此处输入图像描述

进入Word模板: 在此处输入图像描述

要制作这样的输出: 在此处输入图像描述

有什么解决办法吗?

4

1 回答 1

-2

您可以在设置 var 之前使用 utf8_decode 或 htmlentities 函数。例如:

$document->setValue('cif', utf8_decode($cif));
$document->setValue('cif', htmlentities($cif));
于 2015-04-15T13:06:18.540 回答