Forum


Replies: 2   Views: 1456
Add image using template tags in bulk processing
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  · 21-09-2020 - 16:40

Hello,

Replacing placeholders by WordFragments with BulkProcessing methods work with WordFragments that doesn't require injecting the DOCX target.

If you check the API page and the included samples, you can check that all WordFragments added with BulkProcessing use the following structure:

$wordFragment = new WordFragment();

that works perfectly with contents such as texts, links and others that doesn't require adding external files.

But adding an image as WordFragment requires setting the $docx target to add the image:

$wordFragment = new WordFragment($docx);

We have moved the request to the dev team to add support in BulkProcessing too. Using the current stable version of phpdocx, we recommend you to use replaceVariableByWordFragment to accomplish this task with this kind of WordFragments instead of BulkProcessing.

Regards.