Reputation: 311
Generating a Word document with addHtml()
method from PHPWord 0.16 library, I'm not able to control image size. I get image overflow on my resulting Word document.
I have tried 2 different ways 1) by specifying height / width in style attribute and 2) without ....
1) with attributes :
<div style="text-align:center">
<img alt="" src="http://localhost/tmp/library/userfiles/anzac-brisbane-queensland-112487-o.jpg" style="height:450px; width:600px" />
</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut justo feugiat, tincidunt urna et, convallis leo. Vestibulum sed quam ullamcorper, tempus odio ac, congue ex. Nulla nec odio ultricies, faucibus enim nec, rhoncus elit. Proin accumsan nunc nibh, vitae ultrices orci egestas vel. </div>
2) with no attribute :
<div style="text-align:center">
<img alt="" src="http://localhost/tmp/library/userfiles/anzac-brisbane-queensland-112487-o.jpg" />
</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut justo feugiat, tincidunt urna et, convallis leo. Vestibulum sed quam ullamcorper, tempus odio ac, congue ex. Nulla nec odio ultricies, faucibus enim nec, rhoncus elit. Proin accumsan nunc nibh, vitae ultrices orci egestas vel. </div>
I always get overflow ...
Actually, I'd like to :
addHtml()
method. I'm not sure I'm facing a bug or misunderstood how it works. I have also seen that QA.
Upvotes: 0
Views: 1344
Reputation: 496
Adding with and height attributes works for me Remember don't put px into value of attributes
<img alt="" src="http://localhost/tmp/library/userfiles/anzac-brisbane-queensland-112487-o.jpg" width="600" height="450" />
Hope this help someone still has the same problem
Upvotes: 2