IMailMergeCallback Interface

Implement this interface if you want to receive notifications while mail merge is performed.

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

Syntax

public interface IMailMergeCallback

The IMailMergeCallback type exposes the following members.

Methods

  NameDescription
Public methodCode exampleTagsReplaced
Called when "mustache" text tags are replaced with MERGEFIELD fields.

Examples

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()
    {
        TagsReplacedCounter++;
    }

    public int TagsReplacedCounter { get; private set; }
}

See Also