This project is read-only.

loadTemplate and addImage

Dec 13, 2011 at 11:24 AM

Is it possible to use the loadtemplate function and use addImage at the same time. Mine template is working great but when i use the addImage function the template isn't working any more. Is there some one who can help me......

$document = $PHPWord->loadTemplate('Template.docx');


Jul 11, 2012 at 12:38 PM

Did you know the solution?

that's my problem now :(

can you help me!?

Jul 25, 2012 at 6:40 AM

currently, the version can ONLY replace keywords into templates...but there is a trick: from your template, insert "blank" images where you want.

Then, load the template and make the replacements.

Then, save the docx generated from the template: open it with zlib, replace the imagexx.jpg

Nov 15, 2012 at 6:35 AM
Edited Nov 15, 2012 at 6:35 AM

Like kiminox said, it's not possible. Here it is a function that will replace the image. You must put it on PHPWord/Template.php.


public function replaceImage($path,$imageName){




to find out wich one is the image you want to replace, open the docx file with winrar or something similar and take a look a t word/media directory.