[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
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Collapse]Spreadsheet
    Product Structure
   [Expand]Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
   [Expand]Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
   [Expand]Pivot Table Overview
   [Expand]Charting Overview
    Shapes
    Printing
    Protection
    Find and Replace
   [Collapse]Mail Merge
     Template Document
     Mail Merge Functions
   [Expand]Visual Elements
    Services
    Themes and Templates
   [Expand]Shortcuts
   [Expand]Examples
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard 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 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.

Important

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?​​​​​​​