Class AutoFilter
Represents the auto filter class used by the spreadsheet model.
Inherited Members
Namespace: DRIT.Spreadsheet
Assembly: DRIT.Spreadsheet.dll
Syntax
public class AutoFilter
Properties
Columns
Exposes the columns associated with AutoFilter.
Declaration
public ColumnFilterCollection Columns { get; }
Property Value
| Type | Description |
|---|---|
| ColumnFilterCollection | The columns returned by the operation. |
Range
Exposes the range associated with AutoFilter.
Declaration
public Range Range { get; }
Property Value
| Type | Description |
|---|---|
| Range | The range returned by the operation. |
SortState
Exposes the sort state associated with AutoFilter.
Declaration
public SortState SortState { get; set; }
Property Value
| Type | Description |
|---|---|
| SortState |
Methods
Apply()
Applies all filter columns and the sort state (if any) to the auto-filter range. This is the terminal call in a fluent chain started by WithValues(int, bool, params object[]), ByCustom(int, FilterOperator, object), ByTop10(int, bool, bool, int), ByColor(int, SpreadsheetColor), or SortBy(int, bool).
Declaration
public void Apply()
ByColor(int, SpreadsheetColor)
Adds a cell-color filter for the specified column and returns this AutoFilter for fluent chaining. The filter is not applied until Apply() is called.
Declaration
public AutoFilter ByColor(int columnIndex, SpreadsheetColor color)
Parameters
| Type | Name | Description |
|---|---|---|
| int | columnIndex | Zero-based index of the column within the filter range. |
| SpreadsheetColor | color | The cell fill color to match. |
Returns
| Type | Description |
|---|---|
| AutoFilter |
ByCustom(int, FilterOperator, object)
Adds a custom filter (comparison criterion) for the specified column and returns this AutoFilter for fluent chaining. The filter is not applied until Apply() is called.
Declaration
public AutoFilter ByCustom(int columnIndex, FilterOperator @operator, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | columnIndex | Zero-based index of the column within the filter range. |
| FilterOperator | operator | The comparison operator to apply. |
| object | value | The value to compare against. |
Returns
| Type | Description |
|---|---|
| AutoFilter |
ByTop10(int, bool, bool, int)
Adds a top-10 filter for the specified column and returns this AutoFilter for fluent chaining. The filter is not applied until Apply() is called.
Declaration
public AutoFilter ByTop10(int columnIndex, bool top, bool percent, int n)
Parameters
| Type | Name | Description |
|---|---|---|
| int | columnIndex | Zero-based index of the column within the filter range. |
| bool | top | When true the top items are shown; otherwise the bottom items. |
| bool | percent | When true |
| int | n | The number of items (or percentage) to display. |
Returns
| Type | Description |
|---|---|
| AutoFilter |
SortBy(int, bool)
Sets the sort state for the auto-filter range and returns this AutoFilter for fluent chaining. The sort is applied when Apply() is called.
Declaration
public AutoFilter SortBy(int columnIndex, bool ascending)
Parameters
| Type | Name | Description |
|---|---|---|
| int | columnIndex | Zero-based index of the column to sort by. |
| bool | ascending | When true sort ascending; otherwise descending. |
Returns
| Type | Description |
|---|---|
| AutoFilter |
Values(int, bool, params object[])
Exposes the values associated with AutoFilter.
Declaration
public void Values(int columnIndex, bool blanks, params object[] values)
Parameters
| Type | Name | Description |
|---|---|---|
| int | columnIndex | The column index used by the operation. |
| bool | blanks | The blanks used by the operation. |
| object[] | values | The values used by the operation. |
WithValues(int, bool, params object[])
Adds a values filter for the specified column and returns this AutoFilter for fluent chaining. The filter is not applied until Apply() is called.
Declaration
public AutoFilter WithValues(int columnIndex, bool blanks, params object[] values)
Parameters
| Type | Name | Description |
|---|---|---|
| int | columnIndex | |
| bool | blanks | |
| object[] | values |
Returns
| Type | Description |
|---|---|
| AutoFilter |