Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Description

The AutoFilter class represents the filter that is applied to a selected area of cells in a worksheet.

C#
vb.net

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

C#
vb.net

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

Area

Sets or returns an Area object that represents the area of cells that the filter is applied to in the worksheet.

Methods

Name

Description

Clear()

Removes the filter from the worksheet. Calling this method is equivalent to setting the Area property to null.

  • No labels