I have a table with severall fields i use with the mailmerge funcion. Everything goes very well but i have one field that contains HTML text. When the document is merged with my template the output is the raw html. Is there a way so the merge function knows that a specific field contains html so it can transform it or is it not supported in the control or is there a workaround?
Hi,
Thank you for considering Aspose.
Here's the standard approach:
doc.MailMerge.MergeField += new MergeFieldEventHandler(HandleMerge);
private void HandleMerge(object sender, MergeFieldEventArgs e)
{
if (e.FieldName == "HtmlField")
{
mBuilder.MoveToMergeField(e.FieldName);
mBuilder.InsertHtml(e.FieldValue.ToString());
}
}