Replies: 1   Views: 25
Dynamic images in the table

Posted by vitorsantosinfo  · 14-09-2023 - 11:54

Is there a way to display images in my table similar to the method replaceTableVariable?
where for each row of my table an image is displayed.

Posted by admin  · 14-09-2023 - 12:07


Which method are you using to create the table?

If you are using addTable you can use WordFragments. For example:

$imageA = new WordFragment($docx);
$options = array(
    'src' => 'imageA.png'

$imageB = new WordFragment($docx);
$options = array(
    'src' => 'imageB.png'

$valuesTable = array(
        'Title A',
        'Title B',


In the sample included in the package examples/Core/addTable/sample_2.php you can find how to generate a table with contents using WordFragments.

WordFragments can also be used with replaceTableVariable and many other phpdocx methods.