We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

MERGEFIELD Image:MyPhoto behind (or in front of) text?

I am currently successfully using DocIO to merge fields and images (using a MergeImageFieldEventHandler).

However, I have a new requirement to merge some images formatted as "behind text" or "in front of text".

In MS Word, this would correspond to the image's Layout window's "Behind text" or "In front of text" options (screen shot attached).

Can this be accomplished? Thanks!

Attachment: layoutwindow_49e16ebf.zip

2 Replies 1 reply marked as answer

AA Akash Arul Syncfusion Team December 23, 2022 11:22 AM UTC

On further analyzing the details, we found that your requirement is to merge an image with “behind text” or “in front of text” formatting. To achieve this requirement we suggest you to set the pictures TextWrappingStyle as “InFrontOfText” or “Behind” as per your requirement.

Please refer the below code snippet to set the pictures TextWrappingStyle

WPicture picture = args.Picture;
picture.TextWrappingStyle = TextWrappingStyle.InFrontOfText;

Please refer the below UG documentation to know more about other formatting options of the image

We have prepared a sample to meet your requirement. Please refer the sample attached.
Note : The input template document and the input image are in the “Data“ folder

Attachment: Eventforimagemailmergefield_ce04807a.zip

Marked as answer

MK Mike K December 23, 2022 04:38 PM UTC

Perfect, thanks! I was able to set some vertical & horizontal origins & positions as well & get that photo right where I wanted it.

Live Chat Icon For mobile
Up arrow icon