Spreadsheet Mail Merge (Coming soon in v14.1)

At DevExpress we are committed to innovation when it comes to working with and presenting data. Our reporting suite is second to none when it comes to pixel-perfect reporting. Snap was designed to bring mail-merge to the next level: flow based reporting. I am pleased to announce that in our upcoming release we will continue this type of innovation by adding a mail-merge feature to our Windows Spreadsheet control

Setup

Included in the spreadsheet smart tag is the “Create Mail Merge Bars” link.

Spreadsheet Tasks

This action will add the necessary ribbon items to manage the mail merge functionality in the spreadsheet. Additionally, clicking on the “Create Field List Panel” will add the UI necessary for dragging and dropping fields from the data source.

Mail Merge Tools

The two important properties for filling the Field List are “MailMergeDataSource” and “MailMergeDataMember.”

var connection = new SqlConnection(CONNECTION);
var adapter = new SqlDataAdapter("SELECT * FROM Products", connection);
var productsTable = new DataTable("Products");
adapter.Fill(productsTable);
spreadsheetControl1.Document.MailMergeDataSource = productsTable;
spreadsheetControl1.Document.MailMergeDataMember = "Products";

The last two lines are the important bit really: it effectively sets the DataSource and DataMember of the underlying spreadsheet.

Usage

You can add a Detail, Header, and Footer section to the document. Clicking on the “Mail Merge Design View” button will display each of the three regions that have been designated as the “bindable” sections. You can then either drag the fields into the corresponding sections or type them is as formulas.

Formulas

One of the neatest parts is the fact that these fields can also participate in excel functions. That even includes aggregate functions in the Header or Footer sections.

Aggregate Formulas

When clicking on the preview you get exactly what you would expect:

Preview

The aggregate also expands into a sensible excel formula:

Aggregate Preview

Given that this is a spreadsheet we also added the option of the detail repetition happening vertically (as shown above) or horizontally.

Orientation

Conclusion

When it comes to showing data we have the greatest range of flexibility in terms of controls and approaches. I am looking forward to seeing what you create with this!

As always, if there are any comments and/or questions, feel free to get a hold of me!

Seth Juarez
Email: sethj@devexpress.com
Twitter: @SethJuarez

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.