Link in MailMergeField

Hi guys,

Could you tell me is it possible to create link in mail merge field?

Thanks,
Alex

6 Replies

MJ Mohanaselvam Jothi Syncfusion Team January 23, 2018 12:49 PM UTC

Hi Alex,

Thank you for using Syncfusion products.

Could you provide us the following details about your requirement? So that we can work in line with your requirement and provide you the appropriate solution at the earliest.
1. Whether you are trying to add hyperlink using merge fields by performing mail merge?
2. Whether you have different field names in merge field and data source, so you are trying to link the merge field with the data source field before performing mail merge?

Please let us know if you have any other questions.

Regards,
Mohanaselvam J
 



AK Alexander Kurnevich January 23, 2018 01:20 PM UTC

Hi guys,

1. Whether you are trying to add hyperlink using merge fields by performing mail merge?
Yes, I am trying to add hyperlink by performing mail merge.

2. Whether you have different field names in merge field and data source, so you are trying to link the merge field with the data source field before performing mail merge?

The mail merge field has the same name as the field in the data source
I am using the following code:

document.MailMerge.ExecuteNestedGroup(new MailMergeDataTable(_templateMailMergeService.Data.GroupName, _templateMailMergeService.Data.TemplateDataModels));

For now I have to implement the link field on the one page template that uses data from only one record.
«BeginGroup:Cover0»
     «MainTitle»
     «Image:MainImage»
     «Image:MainImage»
     «Text1»

     and here for example I would like to insert some link field
     «Link1»
«EndGroup:Cover0»

Please let me know if you have any other questions.

Thanks,
Alex








MJ Mohanaselvam Jothi Syncfusion Team January 24, 2018 02:10 PM UTC

Hi Alex,

Thank you for your update.

We have prepared sample for your requirement to insert hyperlink for merge field using mail merge functionality of DocIO. Please try the below sample and let us know if this meets your requirement.
https://www.syncfusion.com/downloads/support/forum/135566/ze/GenerateWord-384496421.zip

Please let us know if you have any other questions.

Regards,
Mohanaselvam J
 



AK Alexander Kurnevich January 25, 2018 01:13 PM UTC

Hi guys,

I created console application based on your example.
After running it the "Hyperlink" style is not applied to QrCodeLink filed.

Could you tell me what I am doing wrong?

Thanks,
Alex

Attachment: LinkField_471353cd.zip


MJ Mohanaselvam Jothi Syncfusion Team January 26, 2018 12:56 PM UTC

Hi Alex,

Thank you for your update.

On further analyzing with the given sample, we have found that the merge field (“QrCodeLink”) contains MERGEFORMAT in the field code (Preserve formatting during updates is checked).

Please refer the below screenshot:

 
 
 


Thus the formats of field result are maintained as it is, after updating the merge field. So, the hyperlink style not applied to that field result in the given sample. To achieve your requirement we suggest you to set the hyperlink style for field result, to preserve the format (hyperlink) after updating the merge field. For your reference we have modified the sample to set hyperlink in merge field based on the scenarios whether need to preserve format or not.

Please find the modified sample from the below location:
https://www.syncfusion.com/downloads/support/forum/135566/ze/LinkFieldModified1256540839.zip

Please let us know if you have any other questions.

Regards,
Mohanaselvam J
 



AK Alexander Kurnevich January 26, 2018 02:32 PM UTC

Thanks guys,


Now it works fine.

Alex


Loader.
Up arrow icon