Exporting filter on sfdatagrid filtered columns into Excel
Hello,
Is there a way to export the filter of a filtered sfdatagrid columns into excel ? what we would like to have is from the following sfdatagrid:

the following exported excel sheet with the filters on the header column cells:

is it possible ?
Thank you for your support.
Anas
Is there a way to export the filter of a filtered sfdatagrid columns into excel ? what we would like to have is from the following sfdatagrid:
the following exported excel sheet with the filters on the header column cells:
is it possible ?
Thank you for your support.
Anas
SIGN IN To post a reply.
5 Replies
SR
Sivakumar R
Syncfusion Team
February 11, 2016 03:35 PM UTC
Hi Anas,
This can be achieved by enabling filter for the exported range in sheet. Refer the below code highlighted code,
Thanks,
Sivakumar
This can be achieved by enabling filter for the exported range in sheet. Refer the below code highlighted code,
|
var exportingOptions = new ExcelExportingOptions(); var excelEngine = dataGrid.ExportToExcel(dataGrid.View, exportingOptions); var workBook = excelEngine.Excel.Workbooks[0]; workBook.Worksheets[0].AutoFilters.FilterRange = workBook.Worksheets[0].UsedRange; |
Thanks,
Sivakumar
AE
Anas El Hallabi
February 11, 2016 03:58 PM UTC
Hi Sivakumar,
Thank you for your rapid answer.
If we use the UsedRange, we indeed have the filter for each excel column.
Now, if we have stacked header rows, is there a way to display the filters on the underneath columns not on the stacked Header itself ?
Regards,
Anas
Thank you for your rapid answer.
If we use the UsedRange, we indeed have the filter for each excel column.
Now, if we have stacked header rows, is there a way to display the filters on the underneath columns not on the stacked Header itself ?
Regards,
Anas
SR
Sivakumar R
Syncfusion Team
February 11, 2016 04:24 PM UTC
Hi Anas,
Find the code snippet to enable filter based on stacked header rows.
Documentation:
http://help.syncfusion.com/file-formats/xlsio/worksheet-cells-manipulation#data-filtering
Thanks,
Sivakumar
Find the code snippet to enable filter based on stacked header rows.
|
var exportingOptions = new ExcelExportingOptions(); var excelEngine = dataGrid.ExportToExcel(dataGrid.View, options); var workBook = excelEngine.Excel.Workbooks[0]; var worksheet = excelEngine.Excel.Workbooks[0].Worksheets[0]; var range = "A" + (dataGrid.StackedHeaderRows.Count + 1).ToString() + ":" + worksheet.UsedRange.End.AddressLocal; excelEngine.Excel.Workbooks[0].Worksheets[0].AutoFilters.FilterRange = worksheet.Range[range]; |
Documentation:
http://help.syncfusion.com/file-formats/xlsio/worksheet-cells-manipulation#data-filtering
Thanks,
Sivakumar
AE
Anas El Hallabi
February 11, 2016 04:33 PM UTC
Hi Sivakumar,
Thank you for your response. I was able to place the filters at the right position.
Regards,
Anas
Thank you for your response. I was able to place the filters at the right position.
Regards,
Anas
AP
Ashwini Paranthaman
Syncfusion Team
February 12, 2016 11:47 AM UTC
Hi Anas,
Thank you for the update.
We are glad that your issue has been fixed.
Please let us know if you need any other assistance.
Regards,
Ashwini P.
Thank you for the update.
We are glad that your issue has been fixed.
Please let us know if you need any other assistance.
Regards,
Ashwini P.
SIGN IN To post a reply.
- 5 Replies
- 3 Participants
-
AE Anas El Hallabi
- Feb 11, 2016 12:32 PM UTC
- Feb 12, 2016 11:47 AM UTC