processor.php,使用TemplateProcessor在PHP.Word中添加图像

我不知道是否可以使用TemplateProcessor在

PHPWord模板中添加图像.

我有一个文件(form.docx).该文档是一个模板.我阅读了字段(例如${name})并将其替换为文本.

$template = new TemplateProcessor('form.docx');

$template->setValue('name', $name);

但现在,我想放一张图片,但我不知道我是怎么做的.我尝试这个:

$img='img.jpg';

$template->setValue('image',$img);

不起作用.我尝试其他形式,创建一个部分并将此部分添加到模板但这失败了.

$phpWord = new PhpWord();

$section = $phpWord->createSection();

$section->addImage('img.jpg', array('width'=>210, 'height'=>210, 'align'=>'center'));

$template = new TemplateProcessor('form.docx');

$template->setValue('image',$section).

有人知道如何使用模板将图像放入.docx吗?

谢谢.