We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to get mail merge option highlited

I used aspose to get the output in word, which is opened directly in the client browser, but the mail merge option is not highlited, What to do for it to be highlited.

Thanks for your inquiry. I think that you can use MergeField event and DocumentBuilder class to achieve this. For example see the following code.

public void TestMailMerge_101599()
    Document doc = new Document(@"335_101599_raviteja\in.doc");
    string[] names = { "Field1" };
    string[] values = { "test" };
    doc.MailMerge.MergeField += new MergeFieldEventHandler(MailMerge_MergeField_101599);
    doc.MailMerge.Execute(names, values);
void MailMerge_MergeField_101599(object sender, MergeFieldEventArgs e)
    if (e.FieldName == "Field1")
        DocumentBuilder builder = new DocumentBuilder(e.Document);
        builder.MoveToField(e.Field, true);
        builder.Font.HighlightColor = Color.Yellow;
        e.Text = string.Empty;

I hope that this will help you.
Please let me know if you would like to know something else.
Best regards,