Search code examples
c#epplusepplus-4

epplus Unselect a filter value


In my project I am using epplus to modify excel files. Now in one case I need to add filter on a range and un-select one of the filter options in filter list.

Adding filter is straight forward(myRange.AutoFilter = true) but I don't see any way to specify what options I need to un-select in filter options list. So I am looking for something like below:

myRange.Filter.Values = [value1, value2, ...]; 
or 
myRange.Filter.ExcludedValues = [blabla1, blabla2];

What I already tried:

  1. using epplus I added filter (column where I wanted filter has values Jan, Feb, March)
  2. Hide all rows with column value 'Feb'
  3. Now I expected to have Jan, Feb and March in filter dropdown with Feb being unselected. But doing so 'Feb' got hidden altogether from filter dropdown.

Please suggest if its possible to do something like this using epplus or I am on mission impossible :)


Solution

  • There isnt really an option to unselect values in an autofilter with EPPlus. But you can do it yourself:

    Adding a specific autofilter on a column