[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
    Product Structure
   [Expand]Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
   [Expand]Pivot Table Overview
   [Expand]Charts and Graphics
    Operation Restrictions
    Find and Replace
   [Collapse]Mail Merge
     Template Document
     Mail Merge Functions
   [Expand]Visual Elements
    Themes and Templates
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Mail Merge

The Mail Merge functionality enables you to automatically generate a set of documents based on a single template and include unique data values retrieved from a data source in each document. This feature can be useful for a variety of business requirements, such as personalized letters, and composing catalogs and reports.


The WPF Spreadsheet does not provide mail-merge UI tools (like the WinForms SpreadsheetControl) allowing end-users to design templates, bind them to data sources and preview mail merge results. However, you can generate mail-merge documents in code using the control's API as shown in the How to: Perform a Mail Merge example.

Expanded Mail Merge Process

To perform a mail merge, you need a template and a data source.

  • A template is a document containing placeholders for the information that is merged from a data source (mail merge fields). See the Template Document topic to learn more about mail merge templates.
  • A data source contains data that is merged into a template's fields in merged documents. A data source can be any object that exposes the IList interface, such as a System.Collections.ArrayList or a System.Data.DataTable. You can create a mail merge data source at runtime or retrieve data from an external database using data adapters.

    The data source is bound to the template using the template workbook's IWorkbook.MailMergeDataSource and IWorkbook.MailMergeDataMember properties.

Use the template workbook's IWorkbook.MailMergeOptions property to get access to the mail merge options.

The template workbook's IWorkbook.GenerateMailMergeDocuments method finalizes the mail merging process. It returns a collection of resulting workbooks (if the Single Sheet or Multiple Sheets mail merge mode is used, the collection contains a single workbook). You can open the resulting workbook or save it to a file or stream.

Expanded See Also

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