How is it possible to set a hyperlink over an imag

2019-08-25 05:56发布

问题:

I use phpoffice/phpword (v0.16.0) to generate word-files with php. so far so good. Not I want to wrap a hyperlink around an image. How to achieve that?

I can add a link first, then add the image. So in word, the link is displayed first, then the image. Switch the order switches the order also in word. But i want to add the link to the image.


$section = $phpWord->addSection();
$section->addLink('https://www.google.com', 'Link text');
$section->addImage('img/img1.jpg',
    [
        'width' => 200,
        'height' => 200,
    ]
);

I think, it should be possible to set the image the place of "Link text" in the addLink function. How do I achieve that?