Skip to main content

MailMergeOptions Interface

Defines mail merge options for a specific merge process.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Package: DevExpress.RichEdit.Core

Declaration

[ComVisible(true)]
public interface MailMergeOptions

The following members return MailMergeOptions objects:

Library Related API Members
WinForms Controls RichEditControl.CreateMailMergeOptions()
WPF Controls RichEditControl.CreateMailMergeOptions()
Office File API Document.CreateMailMergeOptions()
IRichEditDocumentServer.CreateMailMergeOptions()
RichEditDocumentServer.CreateMailMergeOptions()
ASP.NET Web Forms Controls ASPxRichEdit.CreateMailMergeOptions()
ASP.NET MVC Extensions RichEditExtension.CreateMailMergeOptions()

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