windowsforms-17838-controls-and-libraries-spreadsheet-examples-mail-merge-how-to-create-a-master-detail-report-without-coding.md
This tutorial uses DevExpress project templates and mail merge functionality to create a master-detail report (without a single line of code).
In Visual Studio, go to “File | New | Project” to create a new project. Select DevExpress v25.2 Template Kit and click Next :
Specify project settings and click Create to run the DevExpress Project Wizard.
Select the WinForms platform. Scroll down to the Office-inspired Controls section and select Spreadsheet Application. Click Create Project.
Run the application to see the result.
Invoke the Spreadsheet’s smart tag menu and click Create Mail Merge Bars to add a Mail Merge tab.
Click Create Field List Panel in the smart tag menu to create a Field List Panel.
Click Create Parameters Panel in the smart tag menu to create a Parameters Panel.
Run the application to see the result.
Create a new workbook. Modify a document by entering captions, changing cell fonts and backgrounds, and formatting cell ranges as shown in the following image.
Activate the Mail Merge Design View to display the template structure. To do this, click the Mail Merge Design View button on the Mail Merge tab, in the Design group.
Click Add Data Source to invoke the Data Source Wizard.
Select Database as the data source type. Click Next.
Select an option to create a new data connection. Click Next.
Select the MS Access 97 data provider and locate the database file nwind.mdb in the Data subfolder of the DevExpress demos. Click Next.
Select an option that does not save credentials. Click Next.
Click Run Query Builder to invoke the Query Designer window that enables you to select data from the data source.
Add the Suppliers table and include all columns in the query.
Click Next to save the query.
Click OK to select the newly created data source.
Click Manage Relations -> Manage Queries to invoke the Query Designer and create a new query for the Products table.
Click Manage Relations -> Manage Queries to invoke the Query Designer and create a new query for the Order Details table.
The resulting template is shown below:
Select the Mail Merge mode. Click Multiple Sheets to place a report for each supplier into an individual worksheet.
Click the Mail Merge Preview button on the Mail Merge tab, in the Design group. A new window with the resulting document opened in a new SpreadsheetControl instance will be invoked.
You can also save a data-bound template to a file in .xls or .xlsx format. All data bindings are saved and will be restored when the spreadsheet control loads a template again.