Hello,
We have tested the following script with phpdocx Corporate 5.5 and it works perfectly:
<?php
require_once 'classes/CreateDocx.inc';
$docx = new CreateDocxFromTemplate('../../files/TemplateSimpleText.docx');
$first = 'PHPDocX';
$multiline = 'This is the first line.\nThis is the second line of text.';
$variables = array('FIRSTTEXT' => $first, 'MULTILINETEXT' => $multiline);
$options = array('parseLineBreaks' =>true);
$docx->replaceVariableByText($variables, $options);
$link = new WordFragment($docx);
$options = array(
'url' => 'http://www.google.es'
);
$link->addLink('Link to Google', $options);
$image = new WordFragment($docx);
$options = array(
'src' => '../../img/image.png'
);
$image->addImage($options);
$valuesTable = array(
array(
'Title A',
'Title B',
'Title C'
),
array(
'Line A',
$link,
$image
)
);
$paramsTable = array(
'tableAlign' => 'center',
'columnWidths' => array(1000, 2500, 3000),
);
$docx->addTable($valuesTable, $paramsTable);
$docx->createDocx('output');
The image is added to the table correctly.
Maybe you are trying to add a WordFragment image to a WordFragment table and then add it to the document, and phpdocx 5.5 doesn't allow it; or the image source isn't a local file but a stream resource.
phpdocx has added a lot improvements when working with WordFragments since the release of phpdocx 5.5, we recommend you to upgrade your license to be able to use them and other features such as streamMode when adding images.
Regards.