Back to Devexpress

RichEditDocumentServer.MailMerge(MailMergeOptions, Stream, DocumentFormat) Method

officefileapi-devexpress-dot-xtrarichedit-dot-richeditdocumentserver-dot-mailmerge-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-mailmergeoptions-system-dot-io-dot-stream-devexpress-dot-xtrarichedit-dot-documentformat-x29.md

latest4.5 KB
Original Source

RichEditDocumentServer.MailMerge(MailMergeOptions, Stream, DocumentFormat) Method

Merges data to the current document and sends the result in the specified format to a stream. Allows you to set mail merge options.

Namespace : DevExpress.XtraRichEdit

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
public void MailMerge(
    MailMergeOptions options,
    Stream stream,
    DocumentFormat format
)
vb
Public Sub MailMerge(
    options As MailMergeOptions,
    stream As Stream,
    format As DocumentFormat
)

Parameters

NameTypeDescription
optionsMailMergeOptions

An object that contains options for the current merge.

| | stream | Stream |

An output stream.

| | format | DocumentFormat |

An enumeration member that indicates the destination format.

|

Remarks

The MailMerge method merges the current document with records retrieved from the MailMergeOptions.DataSource property specified by the options parameter, and sends the merged document to the specified stream.

The MailMerge method triggers the CalculateDocumentVariable event for the RichEditDocumentServer object.

The following code snippets (auto-collected from DevExpress Examples) contain references to the MailMerge(MailMergeOptions, Stream, DocumentFormat) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

word-document-api-use-multiple-data-sources-for-mail-merge/CS/MailMergeSample/Default.aspx.cs#L68

csharp
mailMergeOptions.MergeMode = MergeMode.JoinTables;
documentServer.MailMerge(mailMergeOptions, result, documentFormat);

office-file-api-in-web-api-app/CS/BusinessObjects/Helpers.cs#L50

csharp
server.Options.Export.Html.EmbedImages = true;
server.MailMerge(options, resultStream, documentFormat);

word-document-api-use-multiple-data-sources-for-mail-merge/VB/MailMergeSample/Default.aspx.vb#L56

vb
mailMergeOptions.MergeMode = MergeMode.JoinTables
documentServer.MailMerge(mailMergeOptions, result, documentFormat)
Return result

Implements

MailMerge(MailMergeOptions, Stream, DocumentFormat)

See Also

RichEditDocumentServer Class

RichEditDocumentServer Members

DevExpress.XtraRichEdit Namespace