This sample demonstrates the conversion of content in a Grid Grouping control to an XLS file.
Features:
There are two options for exporting a Grid Grouping Control:
Converting the entire content of a grid
Only converting the visible content of a grid
Advanced settings include options to export styles, preview rows, borders, record plus-minus, and group plus-minus cells.
XlsIO libraries are used to convert grid content to Excel. The dependent .dll files are Syncfusion.XlsIO.Base and Syncfusion.GridConverter.Windows.
Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl converter = new Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl(); converter.GroupingGridToExcel(this.gridGroupingControl1, saveFileDialog.FileName,Syncfusion.GridExcelConverter.ConverterOptions.Default);
The above code converts the entire content of the grid. The code to export the visible or expanded records and groups is given below.
converter.GroupingGridToExcel(this.gridGroupingControl1, saveFileDialog.FileName, Syncfusion.GridExcelConverter.ConverterOptions.Visible);
The code to launch the XLS file is given below.
System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = saveFileDialog.FileName; proc.Start();