officefileapi-devexpress-dot-xtrarichedit-dot-richeditmailmergeoptions.md
Specifies the data source of a mail merge document.
Namespace : DevExpress.XtraRichEdit
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
[DefaultValue(null)]
public virtual object DataSource { get; set; }
<DefaultValue(Nothing)>
Public Overridable Property DataSource As Object
| Type | Default | Description |
|---|---|---|
| Object | null |
The data source.
|
You can access this nested property as listed below:
| Object Type | Path to DataSource |
|---|---|
| RichEditControlOptionsBase |
.MailMerge .DataSource
|
The following data source types are available:
System.Collections.IListSystem.Collections.ArrayListSystem.Data.DataTableWhen a data source contains multiple data tables, use the RichEditMailMergeOptions.DataMember property to specify the required data member.
The code sample below shows how to use the XML data source:
using DevExpress.XtraRichEdit;
using System.Data;
DataSet xmlDataSet = new DataSet();
xmlDataSet.ReadXml("Employees.xml");
xmlDataSet.Tables[0].PrimaryKey = new DataColumn[] {
xmlDataSet.Tables[0].Columns[0] };
using (var wordProcessor = new RichEditDocumentServer())
{
wordProcessor.Options.MailMerge.DataSource = xmlDataSet.Tables[0];
//...
}
Imports DevExpress.XtraRichEdit
Imports System.Data
Private xmlDataSet As New DataSet()
xmlDataSet.ReadXml("Employees.xml")
xmlDataSet.Tables(0).PrimaryKey = New DataColumn() { xmlDataSet.Tables(0).Columns(0) }
Using wordProcessor = New RichEditDocumentServer()
wordProcessor.Options.MailMerge.DataSource = xmlDataSet.Tables[0]
'...
End Using
The following code snippets (auto-collected from DevExpress Examples) contain references to the DataSource 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.
word-document-api-create-master-detail-report/CS/MergeProcessor.cs#L40
suppllierRichEdit.LoadDocument("supplier.rtf");
suppllierRichEdit.Options.MailMerge.DataSource = ds;
winforms-richedit-create-a-master-detail-report/CS/RichEditMasterDetailMailMerge/Form1.cs#L62
//so provide it with a mock data.
mainRichEdit.Options.MailMerge.DataSource = CreateFakeDataSource();
winforms-richedit-customize-merge-fields/CS/Form1.cs#L17
richEditControl1.Options.MailMerge.DataSource = invoices;
}
winforms-richedit-control-mail-merge/CS/MailMerge/Form1.cs#L20
// Set a data source
richEditControl1.Options.MailMerge.DataSource = new SampleData();
richEditControl1.Options.MailMerge.ViewMergedData = true;
winforms-richedit-use-images-in-mail-merge/CS/Form1.cs#L22
{
richEditControl1.Options.MailMerge.DataSource = NorthwindDataProvider.Categories;
richEditControl1.Options.MailMerge.ViewMergedData = true;
word-document-api-create-master-detail-report/VB/MergeProcessor.vb#L40
suppllierRichEdit.LoadDocument("supplier.rtf")
suppllierRichEdit.Options.MailMerge.DataSource = ds
productRichEdit.LoadDocument("detail.rtf")
winforms-richedit-create-a-master-detail-report/VB/RichEditMasterDetailMailMerge/Form1.vb#L58
'so provide it with a mock data:
mainRichEdit.Options.MailMerge.DataSource = CreateFakeDataSource()
winforms-richedit-customize-merge-fields/VB/Form1.vb#L17
invoices.Add(New Invoice(2, "Invoice3", 20.0D, Guid.NewGuid()))
richEditControl1.Options.MailMerge.DataSource = invoices
End Sub
winforms-richedit-control-mail-merge/VB/MailMerge/Form1.vb#L18
'Set a data source
richEditControl1.Options.MailMerge.DataSource = New SampleData()
richEditControl1.Options.MailMerge.ViewMergedData = True
winforms-richedit-use-images-in-mail-merge/VB/Form1.vb#L20
Private Sub richEditControl1_DocumentLoaded(ByVal sender As Object, ByVal e As EventArgs) Handles richEditControl1.DocumentLoaded
richEditControl1.Options.MailMerge.DataSource = NorthwindDataProvider.Categories
richEditControl1.Options.MailMerge.ViewMergedData = True
See Also
RichEditMailMergeOptions Class