Articles in this section
Category / Section

How to export to excel without empty child groups in WinForms GridGroupingControl?

1 min read

Excel export

The child without (empty) records can be hidden/skipped while exporting by canceling the QueryExportNestedTable event of GridGroupingExcelConverterControl.

C#

converter.QueryExportNestedTable += converter_QueryExportNestedTable;
/// <summary>/// Hide the empty elements being exported to Excel./// </summary>void converter_QueryExportNestedTable(object sender, ExportNestedTableEventArgs e)
{
    if (e.NestedTable.Records.Count == 0)
        e.Cancel = true;
}

 

VB

AddHandler converter.QueryExportNestedTable, AddressOf converter_QueryExportNestedTable
''' <summary>
''' Hide the empty elements being exported to Excel.
''' </summary>
Private Sub converter_QueryExportNestedTable(ByVal sender As Object, ByVal e As ExportNestedTableEventArgs)
    If e.NestedTable.Records.Count = 0 Then
         e.Cancel = True
     End If
End Sub

 

Samples:

C#: ExportGrid

VB: ExportGrid

Reference link: https://help.syncfusion.com/windowsforms/classic/gridgroupingcontrol/exporting

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied