Skip to main content

MailMergeOptions Interface

Defines mail merge options for a specific merge process.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v23.2.Core.dll

NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation

Declaration

[ComVisible(true)]
public interface MailMergeOptions

Remarks

To customize mail merge options, pass the MailMergeOptions instance as a parameter to the MailMerge method.

Common mail merge options are specified by the RichEditMailMergeOptions class.

Example

The code sample below specifies mail merge options, runs the mail merge, and saves the document to the specified file.

result

using DevExpress.Office.Services;
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;

using (var wordProcessor = new RichEditDocumentServer())
{
    //...
    wordProcessor.CalculateDocumentVariable += WordProcessor_CalculateDocumentVariable;

    // Register the URI provider service
    IUriStreamService uriStreamService = wordProcessor.GetService<IUriStreamService>();
    uriStreamService.RegisterProvider(new ImageStreamProvider(xmlDataSet.Tables[0], "Photo"));

    MailMergeOptions myMergeOptions =
        wordProcessor.Document.CreateMailMergeOptions();
    myMergeOptions.DataSource = xmlDataSet.Tables[0];
    myMergeOptions.MergeMode = MergeMode.NewSection;

    wordProcessor.MailMerge(myMergeOptions, "result.docx", DocumentFormat.OpenXml);
}
See Also