Support Article
Word merge sporadically inserts raw HTML content in the document
SA-10501
Summary
A small fraction of users sporadically observe distorted Word documents, where raw HTML is merged into the template instead of the expected content. The resulting Word document contains “The operation completed successfully, but returned no content” phrases.

This example shows only a small fragment of the inserted HTML content, which starts with opening <HTML> tag and ends with closing </HTML> tag. If you copy all of it, paste into a file, and load the file into any browser, the following picture will get rendered:

Error Messages
Not Applicable
Steps to Reproduce
1. Embed field { pega:reference .my_property} into a Word template.
2. Make sure property value on Clipboard is blank at runtime.
Note: Since the issue is highly sporadic, following these steps will rarely result in its reproduction.
Root Cause
The following describes the immediate cause of the issue.
When Word macrocode merges field of type {pega:reference .my_property } it invokes activity GetPropertyValue over HTTP to retrieve value of property .my_property.
The first step of activity checks the property value and if it is blank “” replaces it with “ “ space character. This is done to prevent the engine from executing activity ActivityStatusContentNoHandler that returns "Status Good" HTML stream.
In a vast majority of cases on most deployment sites this works as intended, but in this scenario the space character is treated as blank and HTML stream is returned, causing distortions is the Word document layout.
Resolution
Perform the following local-change:
Replace the { pega:reference .my_property } type fields in the Word template with fields of type { pega:insert corrinline=my_corr_rule }.
The my_corr_rule includes the property .my_property serving as a “wrapper” for that property. This is done for every property that ends up equal to blank at runtime.
Always prefer to use { pega:insert corrinline=my_corr_rule } instead of { pega:insert corr=my_corr_rule } in Word documents because { pega:insert corr=my_corr_rule } will include an extra line after the content is merged.
Published November 8, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.