MailMergeOptions Interface | Office File API | DevExpress Documentation Skip to main content

MailMergeOptions Interface

Defines mail merge options for a specific merge process.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v26.1.Core.dll

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.Docx);
}
See Also
Use of this site constitutes acceptance of our Website Terms of Use and Privacy Policy (Updated). Cookies Settings