Basically I am trying to read the filters set by the user in the Excel, remove the filters applied, perform some processing and set the same filters back as set by the user. Following are the lines of code:
Excel.Filters filters = null;
if (Worksheet.AutoFilter != null && Worksheet.AutoFilterMode == true)
{
filters = Worksheet.AutoFilter.Filters;
Worksheet.AutoFilter.ShowAllData();
}
/*
other operations
*/
if (filters != null)
{
//set the filters back
foreach (Excel.Filter filter in filters)
{
}
}
I haven't found success in setting filters back. Even I am not sure if it's the right way to set the filters back.
Any help or suggestion would be great.
Thanks.