Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
   Getting Started
  [Expand]Reporting
  [Expand]Chart Control
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Getting Started
   [Collapse]Concepts
     ASPxRichEdit Control
    [Expand]Document
     Supported Document Formats
     Import and Export
     Formatting Characters
     Formatting Paragraphs
    [Expand]Fields
     Mail Merge
     Restrictions
     Spell Checking
    [Expand]Client API
    [Expand]Built-in Dialogs
     Adaptivity
     HTML Tag Interpretation
     Keyboard Shortcuts
   [Expand]Examples
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]Scheduler
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Mail Merge

The Mail Merge retrieves data from a bound data source and fills in the fields in a document template. This feature is useful for letters, catalogs, mailing labels and for personalizing any kind of a document.

Performing a mail merge in a rich text document requires the following two steps.

  • Specify the RichEdit's data source by using the ASPxDataWebControl.DataSourceID (or ASPxDataWebControlBase.DataSource) property.

  • Create a template by inserting MERGEFIELD fields. The field names refer to data column names of a specified data source.

    Note

    The MERGEFIELD field only enables the substitution of plain text. Formatted text that is inserted from a data source into a merge field will not be recognized and properly parsed. To insert formatted content, use the DOCVARIABLE field.

When an application runs with the mail merge data source attached to the ASPxRichEdit control, ribbon commands of the Mail Merge tab allow end-users to visually insert mail merge fields (placeholders for the dynamic content) from the bound data source, navigate through data source records and preview merged data.

For instance, an end-user can select the field to insert by clicking the Insert Merge Field button in the ribbon. The invoked dialog containing available filed names is shown.

End-users can also initiate the mail merge by clicking the Mail Merge ribbon button in the Finish group. The resulting merged document can be generated for all or specific data source records, and saved to a server folder or downloaded by a client.

 

To perform a mail merge programmatically, call the ASPxRichEdit.MailMerge method. You can pass required parameters by creating the MailMergeOptions instance using the ASPxRichEdit.CreateMailMergeOptions method and specifying it in the MailMerge call. The resulting document can be sent to another ASPxRichEdit control or to the RichEditDocumentServer instance for further processing, can be saved to a file or a Stream object.

Is this topic helpful?​​​​​​​