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

Free Support Forum - aspose.com

Keep Mailmerge Fields in the output document to swich then using ALT+F9


We are evaluating your nice Word component, so, we have a special requirement that another suite supports, so, I need your help, because We want to buy your version…

We need that after that MailMerge is executed the MailMerge Fields keeps in the result document, like Word, where after that you apply the merge, you can switch using ALT+F9 between “MailMerge Fields Definition” and “MailMerge Fields Values”.

If you press ALT+F9 you see the definition and then again ALT+F9 you see the VALUES.

And finally, using your component can I set the default mode ALT+F9 that I want that appears when the document is opened? (Define if I want to see FIELDS DEFINITION or VALUES MODE)

Thanks a lot for your help!

It’s urgent your response, we are so interesting to buy your component, but help on this functionality is fundamental.

Best Regards,

Carlos Ariel


Thank you for your interest in Aspose.Words. Currently this feature is not available in Aspose.Words, but we have logged your requirement in our issue tracking system. Your ticket number is WORDSNET-17804 . You will be notified via this forum thread once this feature is available.

For the time being, you can achieve the desired results by using the following code sample.

Document doc = new Document("D:\\Temp\\input.docx");

doc.MailMerge.FieldMergingCallback = new HandleMergeField();

// Fill the fields in the document with user data.


new String[] {"FullName", "Company", "Address", "Address2", "City"},

new object[] { "James Bond", "MI5 Headquarters", "Milbank", "", "London" }



class HandleMergeField : IFieldMergingCallback


private DocumentBuilder docBuilder;

void IFieldMergingCallback.FieldMerging(FieldMergingArgs args)


if (docBuilder == null)

docBuilder = new DocumentBuilder(args.Document);


docBuilder.InsertField("MERGEFIELD " + args.FieldName + @" \* MERGEFORMAT", args.FieldValue.ToString());


void IFieldMergingCallback.ImageFieldMerging(ImageFieldMergingArgs e)


// Do nothing.



Please check document for your reference.18.11.zip (8.5 KB)