Table of Contents

Class AutoFiltersCollection

Namespace
Spire.Xls.Collections
Assembly
Spire.XLS.dll
public class AutoFiltersCollection : XlsAutoFiltersCollection, IList<object>, ICollection<object>, IEnumerable<object>, IEnumerable, ICloneParent, IAutoFilters, IExcelApplication
Inheritance
AutoFiltersCollection
Implements
Inherited Members

Properties

this[int]

Get auto filter item..

public IAutoFilter this[int columnIndex] { get; }

Parameters

columnIndex int

Property Value

IAutoFilter

Range

Range to be filtered.

public CellRange Range { get; set; }

Property Value

CellRange

Worksheet

Returns parent worksheet. Read-only.

public Worksheet Worksheet { get; }

Property Value

Worksheet

Methods

AddDateFilter(IAutoFilter, DateTimeGroupingType, int, int, int, int, int, int)

public void AddDateFilter(IAutoFilter column, DateTimeGroupingType dateTimeGroupingType, int year, int month, int day, int hour, int minute, int second)

Parameters

column IAutoFilter
dateTimeGroupingType DateTimeGroupingType
year int
month int
day int
hour int
minute int
second int

AddDateFilter(int, DateTimeGroupingType, int, int, int, int, int, int)

Adds a date filter for a filter column.

public void AddDateFilter(int columnIndex, DateTimeGroupingType dateTimeGroupingType, int year, int month, int day, int hour, int minute, int second)

Parameters

columnIndex int
dateTimeGroupingType DateTimeGroupingType

DateTimeGroupingType

year int

The year.

month int

The month.

day int

The day.

hour int

The hour.

minute int

The minute.

second int

The second.

Remarks

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

AddFillColorFilter(IAutoFilter, Color)

public void AddFillColorFilter(IAutoFilter column, Color color)

Parameters

column IAutoFilter
color Color

AddFillColorFilter(int, ExcelPatternType, Color, Color)

Adds a fill color filter.

public void AddFillColorFilter(int columnIndex, ExcelPatternType pattern, Color foreColor, Color backColor)

Parameters

columnIndex int
pattern ExcelPatternType

The background pattern type.

foreColor Color
backColor Color

AddFillColorFilter(int, Color)

Adds a fill color filter.

public void AddFillColorFilter(int filterColumnIndex, Color color)

Parameters

filterColumnIndex int

The column field index on which you want to base the filter (from the left of the list; the leftmost field is field 0).

color Color

Fill Color.

AddFilter(IAutoFilter, string)

public void AddFilter(IAutoFilter column, string criteria)

Parameters

column IAutoFilter
criteria string

AddFilter(int, string)

Adds a filter for a filter column.

public void AddFilter(int columnIndex, string criteria)

Parameters

columnIndex int
criteria string

The specified criteria (a string; for example, "hello"). It only can be null or be one of the cells' value in this column.

AddFontColorFilter(IAutoFilter, Color)

public void AddFontColorFilter(IAutoFilter column, Color color)

Parameters

column IAutoFilter
color Color

AddFontColorFilter(int, Color)

Adds a font color filter.

public void AddFontColorFilter(int columnIndex, Color color)

Parameters

columnIndex int
color Color

Font Color.

AddIconFilter(int, IconSetType, int)

public void AddIconFilter(int columnIndex, IconSetType iconSetType, int iconId)

Parameters

columnIndex int
iconSetType IconSetType
iconId int

Clear()

public void Clear()

ClearFilter(int)

Delete the column filter by column index(filters column index not sheet column index)

public void ClearFilter(int filterColumnIndex)

Parameters

filterColumnIndex int

ClearFilter(string)

Delete the column filter by column name

public void ClearFilter(string columnName)

Parameters

columnName string

CustomFilter(FilterColumn, FilterOperatorType, object)

public void CustomFilter(FilterColumn column, FilterOperatorType operatorType, object criteria)

Parameters

column FilterColumn
operatorType FilterOperatorType
criteria object

CustomFilter(FilterColumn, FilterOperatorType, object, bool, FilterOperatorType, object)

public void CustomFilter(FilterColumn column, FilterOperatorType operatorType1, object criteria1, bool isAnd, FilterOperatorType operatorType2, object criteria2)

Parameters

column FilterColumn
operatorType1 FilterOperatorType
criteria1 object
isAnd bool
operatorType2 FilterOperatorType
criteria2 object

CustomFilter(int, FilterOperatorType, object)

Filters a list with a custom criteria.

public void CustomFilter(int columnIndex, FilterOperatorType operatorType, object criteria)

Parameters

columnIndex int
operatorType FilterOperatorType

The filter operator type

criteria object

The custom criteria

CustomFilter(int, FilterOperatorType, object, bool, FilterOperatorType, object)

Filters a list with custom criterias.

public void CustomFilter(int columnIndex, FilterOperatorType operatorType1, object criteria1, bool isAnd, FilterOperatorType operatorType2, object criteria2)

Parameters

columnIndex int
operatorType1 FilterOperatorType

The first filter operator type

criteria1 object

The first custom criteria

isAnd bool
operatorType2 FilterOperatorType

The second filter operator type

criteria2 object

The second custom criteria

DynamicFilter(IAutoFilter, DynamicFilterType)

public void DynamicFilter(IAutoFilter column, DynamicFilterType dynamicFilterType)

Parameters

column IAutoFilter
dynamicFilterType DynamicFilterType

DynamicFilter(int, DynamicFilterType)

Adds a dynamic filter.

public void DynamicFilter(int columnIndex, DynamicFilterType dynamicFilterType)

Parameters

columnIndex int
dynamicFilterType DynamicFilterType

Dynamic filter type.

Filter()

Filter the data.

public void Filter()

Filter(bool)

Gets all hidden rows's indexes.

public int[] Filter(bool hideRows)

Parameters

hideRows bool

If true, hide the filtered rows.

Returns

int[]

Returns all hidden rows indexes.

FilterTop10(IAutoFilter, bool, bool, int)

Filter the top 10 item in the list

public void FilterTop10(IAutoFilter column, bool isTop, bool isPercent, int itemCount)

Parameters

column IAutoFilter

The column field on which you want to base the filter. for exapmle: sheet.AutoFilters[0]

isTop bool

Indicates whether filter from top or bottom

isPercent bool

Indicates whether the items is percent or count

itemCount int

The item count

FilterTop10(int, bool, bool, int)

Filter the top 10 item in the list

public void FilterTop10(int filterColumnIndex, bool isTop, bool isPercent, int itemCount)

Parameters

filterColumnIndex int

The column field index on which you want to base the filter (from the left of the list; the leftmost field is field 0).

isTop bool

Indicates whether filter from top or bottom

isPercent bool

Indicates whether the items is percent or count

itemCount int

The item count

MatchBlanks(IAutoFilter)

Match all blank cell in the list.

public void MatchBlanks(IAutoFilter column)

Parameters

column IAutoFilter

The column field on which you want to base the filter . for exapmle: sheet.AutoFilters[0]

MatchBlanks(int)

Match all blank cell in the list.

public void MatchBlanks(int columnIndex)

Parameters

columnIndex int

MatchNonBlanks(FilterColumn)

Match all not blank cell in the list.

public void MatchNonBlanks(FilterColumn column)

Parameters

column FilterColumn

The column field on which you want to base the filter . for exapmle: sheet.AutoFilters[0]

MatchNonBlanks(int)

Match all not blank cell in the list.

public void MatchNonBlanks(int filterColumnIndex)

Parameters

filterColumnIndex int

The column field index on which you want to base the filter (from the left of the list; the leftmost field is field 0).

QuickFilter(IAutoFilter, string)

public void QuickFilter(IAutoFilter column, string criteria)

Parameters

column IAutoFilter
criteria string

QuickFilter(int, string)

Filters a list with specified criteria.

public void QuickFilter(int columnIndex, string criteria)

Parameters

columnIndex int
criteria string

The specified criteria (a string; for example, "hello").

Remarks

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

RemoveDateFilter(int, DateTimeGroupingType, int, int, int, int, int, int)

Removes a date filter.

public void RemoveDateFilter(int columnIndex, DateTimeGroupingType dateTimeGroupingType, int year, int month, int day, int hour, int minute, int second)

Parameters

columnIndex int
dateTimeGroupingType DateTimeGroupingType

DateTimeGroupingType

year int

The year.

month int

The month.

day int

The day.

hour int

The hour.

minute int

The minute.

second int

The second.

Remarks

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

RemoveFilter(int, string)

Removes a filter for a filter column.

public void RemoveFilter(int columnIndex, string criteria)

Parameters

columnIndex int
criteria string

The specified criteria (a string; for example, "hello"). It only can be null or be one of the cells' value in this column.