Introduced in build 8.3
The AutoFilter class represents the filter that is applied to a selected area of cells in a worksheet.
To return an
AutoFilter object, use Worksheet.AutoFilter.
There is only one auto filter per worksheet; by default, the filter is not set and AutoFilter.Area will return
When applying an auto filter to a select area of cells on a worksheet, bear in mind:
- AutoFilter.Area must be set to an Area object on the same worksheet as the auto filter.
- There is only one auto filter per worksheet. If AutoFilter.Area is already set, changing
AutoFilter.Areawill overwrite the previous area and the auto filter will be applied to the new area.
AutoFilter.Areamust include all of the cells that the filter applies to. ExcelWriter will not automatically detect the boundaries of the filtered area.
The filter will be removed from the worksheet either by calling the filter's Clear() method, by setting the
Area property to
null, or by deleting all the rows (or just the first row that has the filter headers) or all the columns of the filter from the worksheet.
ArgumentExceptionAn exception of type
ArgumentExceptionwill be thrown if the
AutoFilter.Areaproperty is set to an area that is on a different worksheet, or an empty area that doesn't have any data in it.
Sets or returns an Area object that represents the area of cells that the filter is applied to in the worksheet.