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

Mail Merge - Email field clickable in Word

Hi

I am simply creating a Word template that has a couple of merge fields in Word. The data on one of the merge fields is an email address. I am using a simple string array to populate the template using MailMerge.Execute(fieldNames, fieldValues).

This works.

Now I want the generated file to have the email address to be clickable, and to show the email address as the visible text .. the equivalent of HTML <a rel='nofollow' href="mailto:a@a.com">a@a.com</a>

How can this be done? I did see https://www.syncfusion.com/forums/128620/keep-hyperlinks-on-mailmerging but its not quite the same or explained. 

Thanks

3 Replies

VR Vijay Ramachandran Syncfusion Team June 15, 2017 07:02 AM UTC

Hi Sudhir,

Thank you for contacting Syncfusion support.

You can replace merge field with hyperlink (Email ID) by using merge field event. We have prepared the sample to meet your requirement, you can download the sample from here and let us know if it helps.

In this sample, merge field event will trigger during the Mail merge execution. In the event, we have added new hyperlink with the field value (email id) into merge field owner paragraph and removed the merge field from its owner paragraph. Please refer our UG documentation to know about hyperlinks.

Please let us know if you have any concern.

Regards,
Vijay R
 



UN Unknown Syncfusion Team June 19, 2017 01:52 PM UTC

Greetings

This is a great start ... thanks for the attachment which provided guidance ... I have a follow-up question that I am not finding a process for in the API reference ...

I have a document with many paragraphs, several paragraphs have mail merge fields in between text. The example provided illustrates how to append to the end of a paragraph and then remove the merge field ... how can I replace the merge field with an email hyperlink ...

Sample text ...

This is text. This is text. This is text. This is text. This is text. This is <<MERGEFIELD>> text. This is text. This is text. This is text. This is text. 

I want to replace the Word merge field with an email hyperlink. The data coming into the merge field is the email address in plain text (a@a.com).

Please advise
Thanks


VR Vijay Ramachandran Syncfusion Team June 20, 2017 06:08 AM UTC

Hi Sudhir,

Thank you for your update.

Yes, you can insert the Email hyperlink field at the place of merge field instead of appending to end of the paragraph. We have prepared the sample to meet your requirement, please find the sample from here and let us know if it helps.

In this sample, we have created hyperlink field using AppendHyperlink method and inserted the hyperlink field into merge field owner paragraph at the index of merge field.

Let us know if you have any concern.

Regards,
Vijay R
 


Loader.
Up arrow icon