Forum


Replies: 5   Views: 3568
Image in template table
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 MVa  · 09-09-2013 - 20:13

Hello



 



I have a table with some keywords and one image on a line



How can i change the image for each line i add like i do for the keywords.



 



thx in advance


Posted by MVa  · 10-09-2013 - 08:41

in completion



while {



$tmpf=$tmpimgname.$odorg++.'_odo.png';

$nosImages->OdometerSimple( $tmpf, $nom,$ratioNotes,$seuilorange,$seuilvert);

  $tb[$i]['IMAGEODO']=$tmpf;



}



            $docx->addTemplateVariable($tb,'table',$settings);





Doen't work the image is not replaced



And with



while {



$tmpf=$tmpimgname.$odorg++.'_odo.png';

$nosImages->OdometerSimple( $tmpf, $nom,$ratioNotes,$seuilorange,$seuilvert);

$docx->addTemplateImage('IMAGEODO', $tmpf);;

}



 



Every line of the table have the same image


Posted by jorgelj  · 10-09-2013 - 09:02

Hello,



I recommend you to use text placeholders instead of images and invoke replaceTemplateVariableByHTML method to replace that placeholders.



Regards.


Posted by MVa  · 10-09-2013 - 10:03

[quote=jorgelj]



Hello,



I recommend you to use text placeholders instead of images and invoke replaceTemplateVariableByHTML method to replace that placeholders.



Regards.



[/quote]



Sorry but I don't understand what you mean by replacing with text placeholders



 



R.


Posted by jorgelj  · 10-09-2013 - 15:24

Hello,



You just need to add a placeholder in the document, like $IMAGE$. And then use replaceTemplateVariableByHTML replacing $IMAGE$ with an image tag like <img src=""/>



You can check easy/ReplaceTemplateVariableByHTML.php example.



Regards.