- Online Barcode Generator
- How To
- Buy Now
Export Data in a Group to Excel from GridView
The Kettic GridView .NET WinForms control supports not only exporting data to Excel, but also exporting data in a group from the grouped Kettic GridView to Excel. This is achieved by using the context menu and the C# API included in it. This feature neednât the MS Office installation, however, allows the exported Excel file being read in MS Excel spreadsheet 2003 and higher versions. This article will talk about how to export data in a group to Excel in C#.NET
How to Export Data in a Group to Excel in C#.NET
First, we need to create the Kettic ContextMenu and get the group header row through the methods, MouseDown and GetGridGroupHeaderRowElement. When determining the clicked group row, we can get the child rows of the grouped rows. The following is the C# code that demonstrates how to achieve this.
The ExportToExcel method does not support data exporting to Excel when there is no data specified, so we need to use the ExportToExcelML C# class with DoNotExport for HiddenRowOption property.
In the Kettic GridView.Rows collection, we need to mark the rows matching that of the child collection through changing the Visible property to True and disable the rest. And then change the HiddenRowOption to DoNotExport to export the Kettic GridView. The C# code below shows how to accomplish this.
The C# code below will allows the users to get the text from the GroupRowHeader.
UI Controlsfor Windows Forms.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls