Forum


Replies: 5   Views: 4668
Replacevariablebyhtml image width percent not applying
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 pderep  · 09-06-2016 - 14:57

Hi,

Using replaceVariableByHTML(), I'm trying to insert a simple 3 columns table, with a scaled image inside each cell. No matter what (HTML tags or CSS styles), the images doesn't scale in the resulting DOCX. How can I achieve this:

     $docx = new CreateDocxFromTemplate('htmltest.docx');
        $pdm = <<<EOT
                <table width="100%">
                        <tr>
                                <td width="33%" ><img width="75%" src="image1.png"></td>
                                <td width="33%" ><img width="75%" src="image2.png"></td>
                                <td width="33%" ><img width="75%" src="image3.png"></td>
                        </tr>
                </table>
EOT;

        $docx->replaceVariableByHTML('PDM', 'block', $pdm, array('isFile' => false, 'parseFloats' => true, 'parseDivsAsPs' => false, 'downloadImages' => true));
        $docx->createDocx('htmltest_out');         

Thank you very much,

PdR