hello,
I use CreateDocxFromTemplate() class
I have a table with 3 columns in this template and i want to replace variables with some data.
but the third column is an image which is different on each line
It could be like this code :
<?php
$docx = new CreateDocxFromTemplate('TemplateSimpleTable.docx');
$data = array(
array(
'ITEM' => 'Product A',
'REFERENCE' => '107AW3',
'IMAGE' => '<img src="http://www.w.javadocx.com/img/logo_badge.png" />'
),
array(
'ITEM' => 'Product B',
'REFERENCE' => '204RS67O',
'IMAGE' => '<img src="http://www.w.javadocx.com/img/preview/phpdocx_box_corporate.png" />'
),
array(
'ITEM' => 'Product C',
'REFERENCE' => '25GTR56',
'IMAGE' => '<img src="http://www.w.javadocx.com/img/preview/phpdocx_box_enterprise.png" />'
)
);
$docx->replaceTableVariable($data, array('parseLineBreaks' => true));
?>
but i don't know if :
- replaceTableVariable method can support HTML code instead of basic text
- replaceVariablebyHTML can work on template table (as replaceTableVariable does)
- maybe i have to create wordFragment for each "IMAGE" value in $data php array
thanks for help
regards