MailMergeMailMergeCallback Property

Allows to handle particular events during mail merge.

Namespace:  Aspose.Words.MailMerging
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.9.0


public IMailMergeCallback MailMergeCallback { get; set; }

Property Value

Type: IMailMergeCallback


Shows how to define custom logic for handling events during mail merge.
Document document = new Document();
    document.MailMerge.UseNonMergeFields = true;

    MailMergeCallbackStub mailMergeCallbackStub = new MailMergeCallbackStub();
    document.MailMerge.MailMergeCallback = mailMergeCallbackStub;

    document.MailMerge.Execute(new string[0], new object[0]);

    Assert.AreEqual(1, mailMergeCallbackStub.TagsReplacedCounter);

private class MailMergeCallbackStub : IMailMergeCallback
    public void TagsReplaced()

    public int TagsReplacedCounter { get; private set; }

See Also