Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @DevExpressExampleBot
92 changes: 46 additions & 46 deletions CS/RichEditMasterDetailMailMerge.csproj
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<OutputType>WinExe</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Pictures\**" />
<EmbeddedResource Remove="Pictures\**" />
<None Remove="Pictures\**" />
</ItemGroup>
<ItemGroup>
<None Remove="Data\template-intro.rtf" />
<None Remove="Data\template.docx" />
</ItemGroup>
<ItemGroup>
<None Update="Templates\Detail.rtf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Templates\Master.rtf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Templates\Template.rtf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="nwind.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="DevExpress.Win.Design" Version="25.2.2" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="DevExpress.Win.RichEdit" Version="25.2.2" />
</ItemGroup>
<ItemGroup>
<Content Include="Data\template-intro.rtf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Data\template.docx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<OutputType>WinExe</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Pictures\**" />
<EmbeddedResource Remove="Pictures\**" />
<None Remove="Pictures\**" />
</ItemGroup>
<ItemGroup>
<None Remove="Data\template-intro.rtf" />
<None Remove="Data\template.docx" />
</ItemGroup>
<ItemGroup>
<None Update="Templates\Detail.rtf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Templates\Master.rtf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Templates\Template.rtf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="nwind.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="DevExpress.Win.Design" Version="25.2.2" />
<PackageReference Include="DevExpress.Win.RichEdit" Version="25.2.2" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
<Content Include="Data\template-intro.rtf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Data\template.docx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
38 changes: 26 additions & 12 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,49 @@
<!-- default badges list -->
![](https://img.shields.io/endpoint?url=https://codecentral.devexpress.com/api/v1/VersionRange/128609647/24.2.1%2B)
[![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/E3331)
[![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183)
[![](https://img.shields.io/badge/💬_Leave_Feedback-feecdd?style=flat-square)](#does-this-example-address-your-development-requirementsobjectives)
<!-- default badges end -->

# Rich Text Editor for WinForms - Create a Master-Detail Report
# Rich Text Editor for WinForms - Use Mail Merge to Create a Master-Detail Report

This example illustrates an older approach to creating master-detail documents.
This example uses the Rich Text Editor control and its Mail Merge functionality to generate a product catalog report based on a master-detail template.

> [!IMPORTANT]
> To learn about a newer and more convenient approach to master-detail mail merge, refer to the following article: [Create a Master-Detail Report with a Detail Report Band](https://docs.devexpress.com/XtraReports/4785/create-reports/create-a-master-detail-report-with-a-detail-report-band).
This project uses a two-level **Categories-Products** data source retrieved from **nwind.xml**.

![result](./media/96c27986-26f4-4775-b794-285e373adea7.png)

This project uses a two-level **Categories-Products** hierarchical data source, retrieved from the **nwind.xml** file.
## Implementation Details

![result](./media/96c27986-26f4-4775-b794-285e373adea7.png)
Rich Text Editor supports master-detail mail merge templates. ``TableStart:Name`` and ``TableEnd:Name`` merge fields define master and nested detail regions. Region names should match group or table names in your data source.

This example loads the template to the `RichEditControl` instance located in the **Main Template** tab.

![winforms richedit template tab](./media/richedit-template-tab.png)

This example uses the following APIs to specify the data source:

- [RichEditControl.CreateMailMergeOptions()](https://docs.devexpress.com/OfficeFileAPI/DevExpress.XtraRichEdit.RichEditControl.CreateMailMergeOptions) method - initializes an object with mail merge settings.
- [RichEditMailMergeOptions.DataSource](https://docs.devexpress.com/OfficeFileAPI/DevExpress.XtraRichEdit.RichEditMailMergeOptions.DataSource) - sets the data source.
- [RichEditControl.MailMerge](https://docs.devexpress.com/OfficeFileAPI/DevExpress.XtraRichEdit.RichEditControl.MailMerge.overloads) method - accepts the settings object as a parameter.

In this project, the [RichEditControl.MailMerge](https://docs.devexpress.com/OfficeFileAPI/DevExpress.XtraRichEdit.RichEditControl.MailMerge.overloads) method exports the result to the `RichEditControl` instance located in the **Result** tab.


![winforms richedit template tab](./media/richedit-result-tab.png)

## Files to Review

* [Form1.cs](./CS/Form1.cs) (VB: [Form1.vb](./VB/Form1.vb))

## Documentation

* [How to: Create a Master-Detail Report](https://docs.devexpress.com/OfficeFileAPI/15329/word-processing-document-api/examples/mail-merge/master-detail-report)
* [Mail Merge in Rich Text Documents](https://docs.devexpress.com/WindowsForms/9330/controls-and-libraries/rich-text-editor/mail-merge)


<!-- feedback -->
## Does this example address your development requirements/objectives?

[<img src="https://www.devexpress.com/support/examples/i/yes-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=winforms-richedit-create-a-master-detail-report&~~~was_helpful=yes) [<img src="https://www.devexpress.com/support/examples/i/no-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=winforms-richedit-create-a-master-detail-report&~~~was_helpful=no)

## Does this example address your development requirements/objectives?
[<img src="https://www.devexpress.com/support/examples/i/yes-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=winforms-richedit-create-a-master-detail-report&~~~was_helpful=yes) [<img src="https://www.devexpress.com/support/examples/i/no-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=winforms-richedit-create-a-master-detail-report&~~~was_helpful=no)
(you will be redirected to DevExpress.com to submit your response)
<!-- feedback end -->
Binary file added media/richedit-result-tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/richedit-template-tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.