0

我正在使用 PHPWord 从 html 标签生成文件 .docx。

但 HTML Reader (PHPWord) 中的 img 标签不可用。

Html 阅读器支持以下标签:

`<p>,<h1>,<h2>,<h3>,<h4>,<h5>,<h6>,
<strong>,<em>,<sup>,<sub>,
<table>,<tr>,<td>,<ul>,<ol>,<li>.` 

我特别想知道是否有人可以告诉我如何使用 phpword 读取 img 标签以查看我的 .docx 中的图像

我需要修改这个文件来读取 img 标签。

非常感谢。

4

1 回答 1

0

您可以使用以下内容:

$section = $phpWord->addSection();
$section->addImage(
    'mars.jpg',
    array(
        'width' => 100,
        'height' => 100,
        'marginTop' => -1,
        'marginLeft' => -1,
        'wrappingStyle' => 'behind'
    )
);

见 PHPWORD 文档

于 2015-05-05T07:25:16.803 回答