How to: Programmatically Mark the Data Source as Use for Mail Merge
- 2 minutes to read
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";