Click or drag to resize

ExcelAutoFilter Class

Represents the AutoFilter of a worksheet: the drop-down arrows in the header row of a range and the filters set on its columns. Create it with AddAutoFilter and get it with AutoFilter. A worksheet has at most one AutoFilter (the tables have their own). When a filter is set, the library hides the rows of the range that do not meet the filters of all the columns, as Excel does; Excel keeps the filters and lets the user change them. The first row of the range is the header row and is never hidden. In the Excel 97-2003 format a column can be filtered by at most two values or two conditions. Formula cells are compared by their calculated results (call UpdateFormulaResult first for the formulas added in code).
Inheritance Hierarchy
SystemObject
  ExpertXls.ExcelLibExcelAutoFilter

Namespace: ExpertXls.ExcelLib
Assembly: expertxls (in expertxls.dll) Version: 10.0.0
Syntax
public class ExcelAutoFilter

The ExcelAutoFilter type exposes the following members.

Properties
 NameDescription
Public propertyColumnsCount Gets the number of columns of the filtered range.
Public propertyRange Gets the filtered range, including the header row.
Public propertyWorksheet Gets the worksheet of this AutoFilter.
Top
Methods
 NameDescription
Public methodApplyFilters Applies the filters again after the cell values have changed: the rows of the range that meet the filters of all the columns are shown and the other rows are hidden. The filter methods of this class apply the filters automatically. Filters loaded from an existing workbook that the library cannot evaluate (colors, icons, dates and top 10) leave the rows as they are, as Excel saved them.
Public methodClearAllFilters Removes the filters of all the columns and shows all the rows of the range. The drop-down arrows remain; call RemoveAutoFilter to remove the AutoFilter.
Public methodClearFilter Removes the filter of the specified column and shows again the rows hidden only by it.
Public methodFilterByCondition Shows only the rows whose cell in the specified column meets a condition, for example greater than 100. The filter replaces the previous filter of the column; the filters of the other columns are kept.
Public methodFilterByConditions Shows only the rows whose cell in the specified column meets two conditions joined by And or Or, for example greater than or equal to 10 And less than 20. The filter replaces the previous filter of the column; the filters of the other columns are kept.
Public methodFilterByValues Shows only the rows whose cell in the specified column displays one of the specified values, compared without regard to case. A number or a date is compared by its displayed text, for example "1,250.00". The filter replaces the previous filter of the column; the filters of the other columns are kept. In the Excel 97-2003 format a column can be filtered by at most two values.
Public methodIsFiltered Gets a value indicating if the specified column has a filter.
Top
See Also