You can merge images into a Word Template by using the IMAGE prefix and a public URL that is not subject to anti-scraping protection. You can also use this prefix to specify the height or width of the merged image.
Syntax
{{IMAGE:FieldName}}
“FieldName” is the name of the field from Template Builder that contains the image URL.
Usage
Automatically resize merged images by specifying a height or width value in pixels. The aspect ratio of the image is maintained
To specify the height, include a colon after the merge field name, followed by H=[height in pixels]
To specify the width, include a colon after the merge field name, followed by W=[width in pixels]
Specify either height or width, but not both.
You may use public images by storing the URL in a field in Salesforce
You may use Salesforce Files or Documents by copying the download URL and storing it in a field in Salesforce (see URLs section below)
The file type must be JPG or PNG
Examples
For a field called Photo URL that contains a public URL:
The Word Template merge field syntax will be:
{{IMAGE:Photo_URL}}
To specify an image with a width of 100 pixels:
{{IMAGE:OPPORTUNITY_IMAGE_FIELD:W=100}}
To specify an image with a height of 100 pixels:
{{IMAGE:OPPORTUNITY_IMAGE_FIELD:H=100}}
URLs
To use the public URL for Salesforce Files and Documents:
Create a Text or URL field on your master object to hold the image URL.
Upload an image to Salesforce Documents or as a File on your master record.
Open the image and click Public Link.
Follow all prompts to generate the public URL.
Open the URL into a new window.
If the image has an html wrapper, run the following Query in the Salesforce Developer Console: SELECT ContentDownloadUrl FROM ContentDistribution WHERE ContentDocumentId = '<content document id>' Use the given output of this query as the image address. If the image does not have an html wrapper, right-click on the image and copy the image address.
Paste that link into the field you created in step 1.
Merge the field holding the URL into your Word template and use the IMAGE prefix as shown in the examples above.