Description
The AutoFilter class represents the filter that is applied to a selected area of cells in a worksheet.
Remarks
To return an AutoFilter
object, use Worksheet.AutoFilter.
By default, the filter is not set. If the worksheet doesn't already have a filter, the AutoFilter.Area property will return null
. In order to apply the filter to a selected area of cells in the worksheet, the Area
property has to be set to an Area object. The designated area has to be on the same worksheet. There can only be one filter in a worksheet. However the area of cells that it is applied to can be changed to different areas of cells within the same worksheet through the AutoFilter.Area
property.
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.
Examples
Exceptions
ArgumentException
An exception of type ArgumentException
will be thrown if the AutoFilter.Area
property is set to an area that is on a different worksheet, or an empty area that doesn't have any data in it.
Properties
Name |
Description |
---|---|
Sets or returns an Area object that represents the area of cells that the filter is applied to in the worksheet. |