AutoFilter

AutoFilter class

Represents autofiltering for the specified worksheet.

Properties

NameTypeDescription
SorterDataSorterGets the data sorter.
RangeStringRepresents the range to which the specified AutoFilter applies.
ShowFilterButtonbooleanIndicates whether the AutoFilter button for this column is visible.
FilterColumnsFilterColumnCollectionGets the collection of the filter columns.

Methods

NameDescription
setRangeSets the range to which the specified AutoFilter applies.
getCellAreaGets the CellArea where the specified AutoFilter applies to.
addFilterAdds a filter for a filter column.

MS Excel 2007 supports multiple selection in a filter column. | | addDateFilter | Adds a date filter.

If DateTimeGroupingType is Year, only the param year effects. If DateTiemGroupingType is Month, onl | | removeDateFilter | Removes a date filter.

If DateTimeGroupingType is Year, only the param year effects. If DateTiemGroupingType is Month, | | removeFilter | Removes a filter for a filter column. | | filter | Filters a list with specified criteria.

Aspose.Cells will remove all other filter setting on this field as Ms Excel 97- | | filterTop10 | Filter the top 10 item in the list | | dynamicFilter | Adds a dynamic filter. | | addFontColorFilter | Adds a font color filter. | | addFillColorFilter | Adds a fill color filter. | | addIconFilter | Adds an icon filter.

Only supports to add the icon filter. Not supports checking which row is visible if the filter is | | matchBlanks | Match all blank cell in the list. | | matchNonBlanks | Match all not blank cell in the list. | | custom | Filters a list with a custom criteria. | | showAll | Unhide all rows. | | refresh | Refresh auto filters to hide or unhide the rows. |

AutoFilter.Sorter property

Gets the data sorter.

Type: DataSorter

AutoFilter.Range property

Represents the range to which the specified AutoFilter applies.

Type: String

AutoFilter.ShowFilterButton property

Indicates whether the AutoFilter button for this column is visible.

Type: boolean

AutoFilter.FilterColumns property

Gets the collection of the filter columns.

Type: FilterColumnCollection

setRange(row, startColumn, endColumn)

Sets the range to which the specified AutoFilter applies.

ParameterTypeDescription
rowintRow index.
startColumnintStart column index.
endColumnintEnd column Index.

getCellArea() (1 of 2)

Gets the CellArea where the specified AutoFilter applies to.


getCellArea(refreshAppliedRange) (2 of 2)

addFilter(fieldIndex, criteria)

Adds a filter for a filter column.

MS Excel 2007 supports multiple selection in a filter column.

ParameterTypeDescription
fieldIndexintThe integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
criteriaStringThe specified criteria (a string; for example, “101”). It only can be null or be one of the cells’ value in this column.

addDateFilter(fieldIndex, dateTimeGroupingType, year, month, day, hour, minute, second)

Adds a date filter.

If DateTimeGroupingType is Year, only the param year effects. If DateTiemGroupingType is Month, only the param year and month effect.

ParameterTypeDescription
fieldIndexintThe integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
dateTimeGroupingTypeintA DateTimeGroupingType value. The grouping type
yearintThe year.
monthintThe month.
dayintThe day.
hourintThe hour.
minuteintThe minute.
secondintThe second.

removeDateFilter(fieldIndex, dateTimeGroupingType, year, month, day, hour, minute, second)

Removes a date filter.

If DateTimeGroupingType is Year, only the param year effects. If DateTiemGroupingType is Month, only the param year and month effect.

ParameterTypeDescription
fieldIndexintThe integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
dateTimeGroupingTypeintA DateTimeGroupingType value. The grouping type
yearintThe year.
monthintThe month.
dayintThe day.
hourintThe hour.
minuteintThe minute.
secondintThe second.

removeFilter(fieldIndex, criteria) (1 of 2)

Removes a filter for a filter column.

ParameterTypeDescription
fieldIndexintThe integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
criteriaStringThe specified criteria (a string; for example, “101”). It only can be null or be one of the cells’ value in this column.

removeFilter(fieldIndex) (2 of 2)

Remove the specific filter.

ParameterTypeDescription
fieldIndexintThe specific filter index

filter(fieldIndex, criteria)

Filters a list with specified criteria.

Aspose.Cells will remove all other filter setting on this field as Ms Excel 97-2003.

ParameterTypeDescription
fieldIndexintThe integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
criteriaStringThe specified criteria (a string; for example, “101”).

filterTop10(fieldIndex, isTop, isPercent, itemCount)

Filter the top 10 item in the list

ParameterTypeDescription
fieldIndexintThe integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
isTopbooleanIndicates whether filter from top or bottom
isPercentbooleanIndicates whether the items is percent or count
itemCountintThe item count

dynamicFilter(fieldIndex, dynamicFilterType)

Adds a dynamic filter.

ParameterTypeDescription
fieldIndexintThe integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
dynamicFilterTypeintA DynamicFilterType value. Dynamic filter type.

addFontColorFilter(fieldIndex, color)

Adds a font color filter.

ParameterTypeDescription
fieldIndexintThe integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
colorCellsColorThe CellsColor object.

addFillColorFilter(fieldIndex, pattern, foregroundColor, backgroundColor)

Adds a fill color filter.

ParameterTypeDescription
fieldIndexintThe integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
patternintA BackgroundType value. The background pattern type.
foregroundColorCellsColorThe foreground color.
backgroundColorCellsColorThe background color.

addIconFilter(fieldIndex, iconSetType, iconId)

Adds an icon filter.

Only supports to add the icon filter. Not supports checking which row is visible if the filter is icon filter.

ParameterTypeDescription
fieldIndexintThe integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
iconSetTypeintA IconSetType value. The icon set type.
iconIdintThe icon id.

matchBlanks(fieldIndex)

Match all blank cell in the list.

ParameterTypeDescription
fieldIndexintThe integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).

matchNonBlanks(fieldIndex)

Match all not blank cell in the list.

ParameterTypeDescription
fieldIndexintThe integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).

custom(fieldIndex, operatorType1, criteria1) (1 of 2)

Filters a list with a custom criteria.

ParameterTypeDescription
fieldIndexintThe integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
operatorType1intA FilterOperatorType value. The filter operator type
criteria1ObjectThe custom criteria

custom(fieldIndex, operatorType1, criteria1, isAnd, operatorType2, criteria2) (2 of 2)

Filters a list with custom criteria.

ParameterTypeDescription
fieldIndexintThe integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field 0).
operatorType1intA FilterOperatorType value. The filter operator type
criteria1ObjectThe custom criteria
isAndboolean
operatorType2intA FilterOperatorType value. The filter operator type
criteria2ObjectThe custom criteria

showAll()

Unhide all rows.

refresh() (1 of 2)

Refresh auto filters to hide or unhide the rows.

Returns: Returns all hidden rows’ indexes.


refresh(hideRows) (2 of 2)

Gets all hidden rows’ indexes.

ParameterTypeDescription
hideRowsbooleanIf true, hide the filtered rows.

Returns: Returns all hidden rows indexes.