【问题标题】:Replace html entities with PHPWord setValue function用 PHPWord 的 setValue 函数替换 html 实体
【发布时间】:2014-10-28 19:00:14
【问题描述】:

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

我的意思是替换这个html:

进入Word模板:

要像这样输出:

有什么解决办法吗?

【问题讨论】:

  • 您找到解决方案了吗?

标签: javascript php xml codeigniter phpword


【解决方案1】:

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

$document->setValue('cif', utf8_decode($cif));
$document->setValue('cif', htmlentities($cif));

【讨论】:

  • 能否请您详细说明您的答案,添加更多关于您提供的解决方案的描述?
猜你喜欢
  • 2018-01-06
  • 2021-10-09
  • 2015-07-22
  • 2012-08-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-02-04
相关资源
最近更新 更多