Forum


Replies: 1   Views: 3827
Replaceplaceholderimage not working
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 wcalhoun  · 16-07-2015 - 18:19

I am trying to replace a placeholder image and it is not working. Here is the code I am using: require_once 'phpdocx/classes/CreateDocx.inc'; $docx = new CreateDocxFromTemplate('templates/test.docx'); $docx->replacePlaceholderImage('IMAGE', 'test.jpg'); $fileName=date('ymdHis'); $docx->createDocx('files/'); echo "

Your document has been generated.

docx

"; And on my template, I put $IMAGE$ in the Alternative Text for the image. The code completes and created my document, but it does not replace the placeholder image. I know the path to the replacement image is right, because if I modify it, I get an error.

Posted by wcalhoun  · 17-07-2015 - 12:17

I figured it out. I was using Word 2003 with the Office 2007 compatibility pack to save the docx and it didn't work, I tried it on a copy of Office 2010 and it worked.