Forum


Replies: 3   Views: 190
Replacevariablebyhtml and img with a float
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by ninof  · 05-02-2024 - 02:47

There appears to be a bug with having an image with a float attribute when using replaceVariableByHTML The following code always produces a corrupt .docx - at least when trying to open the output in Word 2007 (I know).

$docx=new CreateDocxFromTemplate("../tmp/Test.docx",array('parseMode'=>true));
$docx->setTemplateSymbol('|');

$html="<p><img src='../tmp/test.jpg' style='float:right;' alt='img_qrcode'>Testing floating image<br>line 1<br>line 2<br>line 3<br>line 4<br>line 5<br>line 6<br></p>";
$docx->replaceVariableByHTML('iHowtovote','block',$html, array('isFile' => false,'parseFloats' => true, 'downloadImages' => true));

$docx->createDocx("../tmp/Output.docx");