Back to Devexpress

MailMergeOptions.MergeMode Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-mailmergeoptions-95a80a39.md

latest6.6 KB
Original Source

MailMergeOptions.MergeMode Property

Gets or sets how the merged ranges are delimited in the resulting document.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
MergeMode MergeMode { get; set; }
vb
Property MergeMode As MergeMode

Property Value

TypeDescription
MergeMode

An enumeration value that indicates the delimiter.

|

Available values:

NameDescription
NewParagraph

Specifies that the next merged range starts with a new paragraph.

| | NewSection |

Specifies that the next merged range starts with a new section. The section break type is obtained from the previous section break or set to the NextPage by default. For headers and footers, it is the only allowed option.

| | JoinTables |

Enables you to join rows, which result from a mail merge involving a table with merged fields, into a whole table.

|

Remarks

If a merge field is located in a document’s header or footer , the MergeMode should be set to MergeMode.NewSection for proper operation.

The following code snippets (auto-collected from DevExpress Examples) contain references to the MergeMode property.

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.

winforms-richedit-control-mail-merge/CS/MailMerge/Form1.cs#L29

csharp
myMergeOptions.LastRecordIndex = 3;
myMergeOptions.MergeMode = MergeMode.NewSection;

word-document-api-create-master-detail-report/CS/Program.cs#L51

csharp
// Each merged record starts in a new section, preserving page setup and headers/footers per record.
myMergeOptions.MergeMode = MergeMode.NewSection;
wordProcessor.CalculateDocumentVariable += WordProcessor_OnCalculateDocumentVariable;

winforms-richedit-use-images-in-mail-merge/CS/Form1.cs#L43

csharp
MailMergeOptions options = richEditControl1.Document.CreateMailMergeOptions();
options.MergeMode = MergeMode.NewSection;
string fileName = System.IO.Directory.GetCurrentDirectory() + @"MailMergeResult.rtf";

winforms-richedit-use-calculatedocumentvariable-event-to-insert-formatted-content/CS/Form1.cs#L33

csharp
MailMergeOptions myMergeOptions = richEditControl1.Document.CreateMailMergeOptions();
myMergeOptions.MergeMode = MergeMode.NewParagraph;

how-to-use-docvariable-fields/CS/DocumentVariablesExample/Form1.cs#L36

csharp
MailMergeOptions myMergeOptions = richEditControl1.Document.CreateMailMergeOptions();
myMergeOptions.MergeMode = MergeMode.NewSection;
this.Cursor = Cursors.WaitCursor;

winforms-richedit-control-mail-merge/VB/MailMerge/Form1.vb#L26

vb
myMergeOptions.LastRecordIndex = 3
myMergeOptions.MergeMode = MergeMode.NewSection

winforms-richedit-use-images-in-mail-merge/VB/Form1.vb#L36

vb
Dim options As MailMergeOptions = richEditControl1.Document.CreateMailMergeOptions()
options.MergeMode = MergeMode.NewSection
Dim fileName As String = System.IO.Directory.GetCurrentDirectory() & "MailMergeResult.rtf"

winforms-richedit-use-calculatedocumentvariable-event-to-insert-formatted-content/VB/Form1.vb#L27

vb
Dim myMergeOptions As MailMergeOptions = richEditControl1.Document.CreateMailMergeOptions()
myMergeOptions.MergeMode = MergeMode.NewParagraph
Dim server As RichEditDocumentServer = New RichEditDocumentServer()

how-to-use-docvariable-fields/VB/DocumentVariablesExample/Form1.vb#L36

vb
Dim myMergeOptions As MailMergeOptions = richEditControl1.Document.CreateMailMergeOptions()
myMergeOptions.MergeMode = MergeMode.NewSection
Cursor = Cursors.WaitCursor

winforms-richedit-create-a-master-detail-report/VB/RichEditMasterDetailMailMerge/Form1.vb#L108

vb
Dim options As MailMergeOptions = detailRichEdit.CreateMailMergeOptions()
options.MergeMode = MergeMode.JoinTables
options.LastRecordIndex = 10

See Also

MailMerge

MailMergeOptions Interface

MailMergeOptions Members

DevExpress.XtraRichEdit.API.Native Namespace