In SfDataGrid control, you can export data to Excel by using the ExportToExcel method that has ExcelExportingOptions as an argument. ExcelExportingOptions provides various properties to customize the exporting. You can expand or collapse the exported group in Excel by setting the AllowOutlining property to True in ExcelExportingOptions. The default value of this property is True, so you can expand or collapse the exported group in Excel until you explicitly set this property as False.
The following snapshot illustrates the result of the above code in SfDataGrid.
Expanded and Collapsed group in Grid:
Expanded and Collapsed group in the Exported Excel:
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:||.NET Framework:||Product Version:|