Back to Devexpress

How to: Perform a Mail Merge

wpf-120128-controls-and-libraries-spreadsheet-examples-mail-merge-how-to-perform-a-mail-merge.md

latest1.3 KB
Original Source

How to: Perform a Mail Merge

  • Sep 27, 2023
  • 3 minutes to read

This tutorial shows how to use the Spreadsheet Mail Merge functionality to automatically generate a document based on data retrieved from a data source.

  1. Create a mail merge template and specify template ranges.

  2. Define the mail merge mode and document orientation. In this example, the mail merge mode is set to Multiple Sheets so that each data record is merged into a separate worksheet in a single workbook.

  3. Use the IWorkbook.MailMergeDataSource property to bind a mail merge template to a data source. Perform a mail merge using the IWorkbook.GenerateMailMergeDocuments method. The resulting workbook can be saved to a file or stream, or sent to another SpreadsheetControl for further processing.