Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Attached images do not appear inserted in merged Word document



The application employs Word Merge functionality to dynamically insert images, stored as work item attachments, into the Word document. Word template contains field objects of type { pega:insert corr=corr_name }. The correspondence pulled during merge contains embedded pzInsKeys of attached images.  When merge process completes these images should appear inserted into the Word document.
The application written in PRPC 6.2 SP2, was subsequently upgraded to run on the Pega 7.1.8 platform. The images appear correctly in the original application. After upgrade, the image pzInsKeys appear inserted instead of the expected images.

Error Messages

Not Applicable

Steps to Reproduce

Use fields of type { pega:insert corr=corr_name } to dynamically merge images into the Word template.

Root Cause

When Word merge process encounters field of type { pega:insert corr=corr_name }, the macrocode invokes activity getCorrInsert over HTTP. The returned HTML formatted string is inserted into the document in place of the field object, which is removed. Macrocode forces Word to render the HTML markup.
In the Pega 7 version, the getCorrInsert activity returns string, in which inserted images appear in the following format:
<PegaDocumentObject>DATA-WORKATTACH-FILE XXX-IT-YYY-WORK IR-316!20160329T145905.302 GMT</PegaDocumentObject>
While in the original application, the getCorrInsert activity returns string, in which inserted images appear in the following format:
<span style="mso-element:field-begin"></span>pega:binary attachfile=pyAttachStream.image.jpg.DATA-WORKATTACH-FILE XXX-IT-YYY-WORK IR-636!20160329T182949.093 GMT<span style="mso-element:field-end"></span>
Upon HTML markup rendering the two highlighted SPAN elements get converted into a field object with content of type   { pega:binary attachfile=some_image_pzInsKey }   and dynamically appended to the collection of template field objects.
When macrocode later processes this field object, the image gets pulled from the server over HTTP and inserted into the document.  In the Pega 7 version this markup is missing, which explains the issue.


Make sure custom stream returned by the getCorrInsert activity contains images in format <span style="mso-element:field-begin"></span>pega:binary attachfile=image_pzInsKey<span style="mso-element:field-end"></span>


Published April 10, 2016 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us