A filtered GridGroupingControl - sending the filtered data to a Excel worksheet

I would like to send the filtered data of a GridGroupingControl to a excel worksheet. I am using some sample code but that only sends the whole table (with no filtereing) to the Excel sheet. How can I just send the data that is being show on the datagrid? Here is the code I was using...



string fileName;
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2010;
fileName = "Sample.xlsx";
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];

if(gridReport.DataSource != null)
{
sheet.ImportDataTable((DataTable)gridReport.DataSource, true, 3, 1, -1, -1);

//??sheet.ImportDataView(new DataView(gridReport
}
.
.


}


3 Replies

JJ Jisha Joy Syncfusion Team September 3, 2010 10:34 AM UTC

Hi David,

You could achieve the desired behavior by using GroupingGridExcelConverterControl and setting the ConverterOptions to visible.

Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl converter = new
Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl();
converter.GroupingGridToExcel(this.gridGroupingControl1,
"sample.xls", Syncfusion.GridExcelConverter.ConverterOptions.Visible);



Regards,
Jisha



DM David Mecteaux September 3, 2010 02:51 PM UTC

Well I am doing something like that already....but I was looking at the ExcelEngine class and was thinking about some advanced things I could do to when I export to Excel from the GridGroupingControl.



JJ Jisha Joy Syncfusion Team September 7, 2010 11:56 AM UTC

Hi David,

Thank you for your update. Is it Possible for you to provide us a sample showing the issue?.

Regards,
Jisha


Loader.
Up arrow icon