Forum


Replies: 5   Views: 414
Replaceplaceholderimage does not add the image
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 admin  · 19-04-2023 - 11:30

Hello,

If you don't want to replace the paragraph styles that wrap the placeholder and other contents in the same paragraph when using replaceVariableByWordFragment, you need to set the type option to 'inline':

$docx->replaceVariableByWordFragment(array('WORDFRAGMENT' => $wf), array('type' => 'inline'));

Some styles may be need to applied when generating the WordFragment with the image using addImage. On addImage you can read all available options when generating an image.

Also please check the documentation available on:

https://www.phpdocx.com/documentation/snippets/adding-images-side-by-side

that details a similar case of use, although using a single placeholder.

Regards.