RichEditControl.MailMergeRecordFinished Event
Fires after each data record is merged with the document in the mail merge process.
Namespace: DevExpress.XtraRichEdit
Assembly: DevExpress.XtraRichEdit.v20.1.dll
NuGet Package: DevExpress.Win.RichEdit
Declaration
Event Data
The MailMergeRecordFinished event's data class is MailMergeRecordFinishedEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Cancel | Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs. |
Document | Gets a merged document. |
RecordDocument | Gets a template document after a record is merged. |
RecordIndex | Gets an index of a record currently merged. |
Remarks
The MailMergeRecordFinished event can be used to post-process the merged section of a document that corresponds to a particular record. The following code snippet demonstrates that, after each record is merged, a custom footer is appended.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-use-document-variable-docvariable-fields-e3099
private void richEditControl1_MailMergeRecordFinished(object sender, MailMergeRecordFinishedEventArgs e) {
e.RecordDocument.AppendDocumentContent("Docs\\bungalow.docx", DocumentFormat.OpenXml);
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the MailMergeRecordFinished event.
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.