Specifies the name of a data source used for mail merge.
A String value, specifying the data source name.
The IDataDispatcherOptions interface is implemented in the SnapMailMergeVisualOptions class and the DataSourceName property is accessible with the SnapControl.Options.SnapMailMergeVisualOptions.DataSourceName notation.
Set this option to enable the "Use for Mail Merge" option in Data Explorer for the specified data source, as illustrated in the following picture.
If there is a data source specified with the SnapControl.DataSource property, set the DataSourceName property to any value to enable mail merge for this data source.
To use a data source from the SnapControl.DataSources collection for a mail merge data source, assign the name of the data source to the DataSourceName property.
The SnapControl.DataSources collection belongs to a document loaded in the control. When another document is loaded or a new document is created, the control prompts the user whether to maintain the data source connections that exist in the currently open document. If the answer is no, the SnapControl.DataSources collection is cleared and populated with data sources contained in the loaded document. For the new document, only the data source specified with the SnapControl.DataSource property is available.
We do not recommend using data sources which are not marked as Use for Mail Merge to perform mail merge.
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-bind-a-snap-document-to-multiple-data-sources-in-code-e4784
// Set the Application data source which cannot be edited or removed by the end-user. this.snapControl1.DataSource = dsContacts.Tables; // Add Document data sources which persist for the currently loaded document only. this.snapControl1.Document.BeginUpdateDataSource(); this.snapControl1.Document.DataSources.Add("Products", products); this.snapControl1.Document.DataSources.Add("Categories", categories); this.snapControl1.Document.DataSources.Add("Sales", myExcelSource); this.snapControl1.Document.EndUpdateDataSource(); // Set the default (Application) data source as the mail merge source ("Use for Mail Merge" option). this.snapControl1.Options.SnapMailMergeVisualOptions.DataSourceName = ""; // Uncomment the following line to set the Sales data source as the mail merge source. // this.snapControl1.Options.SnapMailMergeVisualOptions.DataSourceName = "Sales";