【问题标题】:Add image to file Word using addHtml in PhpWord使用 PhpWord 中的 addHtml 将图像添加到文件 Word
【发布时间】:2020-02-01 18:08:37
【问题描述】:

我在 PhpWord 中有一个问题,我正在尝试使用 Html 代码将图像添加到单词中,但这不起作用。 我使用了 Visual Studio 代码,图像位于 public 文件夹中。 谢谢你帮助我。

$html = '<table>
  <tr>
    <th>Header</th>
    <td>Content</td>
    <td> <img src'.public_path().'/phone.jpg></td>
  </tr>
</table>';

\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html);

【问题讨论】:

    标签: html phpword


    【解决方案1】:

    大约一个月前被问到,您可能已经想通了?看起来您的“src”属性后面缺少“=”。此外,很确定 html 坚持将属性值放在引号内,即使这在 css 中是允许的——这可能会使 phpword 关闭,不确定。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-24
      • 2014-11-10
      • 1970-01-01
      • 2021-11-01
      • 1970-01-01
      • 2015-05-11
      相关资源
      最近更新 更多