在PhpWord中创建正确的浮动图像

use*_*494 3 php phpword

我想要一个右边的图像,左边的文字漂浮在图像周围.反过来非常好,在文档Recipies部分也有一个例子.但是,我没有使用浮在右边的图像.我尝试了什么:

addImage('myimage.png', 
   array(
       'width'=>320, 
       'height'=>240, 
       'align'=>'right',
       'wrappingStyle'=>'square',
       'positioning' => 'absolute'
   )
);
Run Code Online (Sandbox Code Playgroud)

要么

addImage('myimage.png', 
   array(
       'width'=>320, 
       'height'=>240, 
       'align'=>'right',
       'wrappingStyle'=>'square',
       'positioning' => 'absolute',
       'posHorizontalRel' => 'margin',
       'posVerticalRel' => 'line'
   )
);
Run Code Online (Sandbox Code Playgroud)

我还尝试了负像宽度等,但这两者都没有用.不幸的是,整个项目的文档真的很差,至少在phpword.readthedocs.org.

小智 5

我也有同样的问题,到目前为止互联网上没有答案.所以这就是我提出的:

$section->addImage('image.png', array(
    'width' => 40,
    'height' => 40,
    'wrappingStyle' => 'square',
    'positioning' => 'absolute',
    'posHorizontal'    => \PhpOffice\PhpWord\Style\Image::POSITION_HORIZONTAL_RIGHT,
    'posHorizontalRel' => 'margin',
    'posVerticalRel' => 'line',
));
Run Code Online (Sandbox Code Playgroud)