How to Add Dynamic Images to a Microsoft Word Mail Merge
Question details
The user needs to insert varying JPEG images into a Microsoft Word mail merge based on file paths stored in a data source column.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- Performing a mail merge that requires different images to be generated for each individual merged document.
- Observed behavior
- Requires the correct formatting and insertion of nested field codes so that the corresponding image loads properly for each record during the document merge.
Ensure that your data source (such as an Excel spreadsheet) contains a dedicated column with the exact, full file paths to your images, and verify that the image files actually exist in those directory locations.
Use Nested INCLUDEPICTURE and MERGEFIELD Field Codes
Insert dynamic images by combining the INCLUDEPICTURE and MERGEFIELD codes in your Word document to pull file paths directly from your data source.
To make images change dynamically per record, you must nest a MERGEFIELD code inside an INCLUDEPICTURE field code. Standard insertion of a merge field will only output the text of the file path, not the image itself.
Click where you want the image to appear. Press Ctrl + F9 on your keyboard to insert a pair of field code braces { }.
Inside the braces, type INCLUDEPICTURE followed by a space, quotation marks, and the \d switch. It should look like this: { INCLUDEPICTURE "" \d }.
Place your text cursor directly between the empty quotation marks and press Ctrl + F9 again to insert a second set of braces.
In the new inner braces, type MERGEFIELD followed by a space and your data source column name (e.g., PictureLocation). The final code must look exactly like: { INCLUDEPICTURE "{ MERGEFIELD PictureLocation }" \d }.
Finish your mail merge to a new document. Select all text in the new document by pressing Ctrl + A, then press F9 to refresh the fields and force the images to display.

Create Dynamic Mail Merges Effortlessly in WPS Writer
WPS Writer offers a comprehensive Mail Merge feature that seamlessly handles data sources and field codes. You can easily merge text and dynamic images while enjoying a highly intuitive interface.
- 1. Prepare your document: Open your main document in WPS Writer and navigate to the 'Mailings' or 'References' tab on the top ribbon.
- 2. Link your data source: Click 'Open Data Source' and select your spreadsheet containing the image file paths.
- 3. Insert the field codes: Use Ctrl + F9 to manually insert the nested INCLUDEPICTURE and MERGEFIELD codes, just as you would in standard Word processing.
- 4. Merge and update: Click 'Merge to New Document' to generate your files, then press Ctrl + A and F9 to refresh and reveal the dynamic images.

Frequently Asked Questions
Why are my images not showing up after completing the mail merge?
Word does not always automatically update nested field codes upon merging. You must force the fields to update by pressing Ctrl + A to select the entire merged document, and then pressing F9 on your keyboard to refresh the codes and load the images.
Do I need to format the file paths in my Excel spreadsheet a specific way?
Yes, in many cases, Windows file paths in data sources require double backslashes (e.g., C:\\Images\\photo.jpg) instead of single backslashes so the merge field correctly interprets the directory path without escaping characters.
Can I use relative file paths for my mail merge images?
Using full absolute paths (e.g., C:\Users\Name\Documents\Images) is highly recommended. Relative paths often break depending on where the merged document is saved or executed from, resulting in broken image links.
How can I make all the dynamic images exactly the same size?
The INCLUDEPICTURE field brings in the image at its native resolution or size. To ensure uniformity, it is best to resize all your source images to the exact same dimensions in an image editor before running the mail merge, or place the field code inside a fixed-size table cell to constrain its dimensions.




