A newer version of this page is available. Switch to the current version.

RichEditControl.MailMergeRecordStarted Event

Fires before each data record is merged with the document in the mail merge process.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.XtraRichEdit.v19.1.dll


public event MailMergeRecordStartedEventHandler MailMergeRecordStarted

Event Data

The MailMergeRecordStarted event's data class is MailMergeRecordStartedEventArgs. 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 before a record is merged.
RecordIndex Gets an index of a record currently merged.


The MailMergeRecordStarted event can be used to pre-process the merged section of a document that corresponds to a particular record. The following code snippet demonstrates how to insert a creation time mark for each merged record in the resulting document.

        private void richEditControl1_MailMergeRecordStarted(object sender, MailMergeRecordStartedEventArgs e) {
            DocumentRange _range = e.RecordDocument.InsertText(e.RecordDocument.Range.Start,
String.Format("Created on {0:G}\n\n", DateTime.Now));
            CharacterProperties cp = e.RecordDocument.BeginUpdateCharacters(_range);
            cp.FontSize = 8;
            cp.ForeColor = Color.Red;
            cp.Hidden = true;
See Also