Excel.Filter class
Manages the filtering of a table's column.
- Extends
Remarks
Properties
context | The request context associated with the object. This connects the add-in's process to the Office host application's process. |
criteria | The currently applied filter on the given column. |
Methods
apply(criteria) | Apply the given filter criteria on the given column. |
apply |
Apply a "Bottom Item" filter to the column for the given number of elements. |
apply |
Apply a "Bottom Percent" filter to the column for the given percentage of elements. |
apply |
Apply a "Cell Color" filter to the column for the given color. |
apply |
Apply an "Icon" filter to the column for the given criteria strings. |
apply |
Apply an "Icon" filter to the column for the given criteria strings. |
apply |
Apply a "Dynamic" filter to the column. |
apply |
Apply a "Dynamic" filter to the column. |
apply |
Apply a "Font Color" filter to the column for the given color. |
apply |
Apply an "Icon" filter to the column for the given icon. |
apply |
Apply a "Top Item" filter to the column for the given number of elements. |
apply |
Apply a "Top Percent" filter to the column for the given percentage of elements. |
apply |
Apply a "Values" filter to the column for the given values. |
clear() | Clear the filter on the given column. |
load(options) | Queues up a command to load the specified properties of the object. You must call |
load(property |
Queues up a command to load the specified properties of the object. You must call |
load(property |
Queues up a command to load the specified properties of the object. You must call |
toJSON() | Overrides the JavaScript |
Property Details
context
The request context associated with the object. This connects the add-in's process to the Office host application's process.
context: RequestContext;
Property Value
criteria
The currently applied filter on the given column.
readonly criteria: Excel.FilterCriteria;
Property Value
Remarks
Method Details
apply(criteria)
Apply the given filter criteria on the given column.
apply(criteria: Excel.FilterCriteria): void;
Parameters
- criteria
- Excel.FilterCriteria
The criteria to apply.
Returns
void
Remarks
applyBottomItemsFilter(count)
Apply a "Bottom Item" filter to the column for the given number of elements.
applyBottomItemsFilter(count: number): void;
Parameters
- count
-
number
The number of elements from the bottom to show.
Returns
void
Remarks
applyBottomPercentFilter(percent)
Apply a "Bottom Percent" filter to the column for the given percentage of elements.
applyBottomPercentFilter(percent: number): void;
Parameters
- percent
-
number
The percentage of elements from the bottom to show.
Returns
void
Remarks
applyCellColorFilter(color)
Apply a "Cell Color" filter to the column for the given color.
applyCellColorFilter(color: string): void;
Parameters
- color
-
string
The background color of the cells to show.
Returns
void
Remarks
applyCustomFilter(criteria1, criteria2, oper)
Apply an "Icon" filter to the column for the given criteria strings.
applyCustomFilter(criteria1: string, criteria2?: string, oper?: Excel.FilterOperator): void;
Parameters
- criteria1
-
string
The first criteria string.
- criteria2
-
string
Optional. The second criteria string.
- oper
- Excel.FilterOperator
Optional. The operator that describes how the two criteria are joined.
Returns
void
Remarks
applyCustomFilter(criteria1, criteria2, operString)
Apply an "Icon" filter to the column for the given criteria strings.
applyCustomFilter(criteria1: string, criteria2?: string, operString?: "And" | "Or"): void;
Parameters
- criteria1
-
string
The first criteria string.
- criteria2
-
string
Optional. The second criteria string.
- operString
-
"And" | "Or"
Optional. The operator that describes how the two criteria are joined.
Returns
void
Remarks
applyDynamicFilter(criteria)
Apply a "Dynamic" filter to the column.
applyDynamicFilter(criteria: Excel.DynamicFilterCriteria): void;
Parameters
- criteria
- Excel.DynamicFilterCriteria
The dynamic criteria to apply.
Returns
void
Remarks
applyDynamicFilter(criteriaString)
Apply a "Dynamic" filter to the column.
applyDynamicFilter(criteriaString: "Unknown" | "AboveAverage" | "AllDatesInPeriodApril" | "AllDatesInPeriodAugust" | "AllDatesInPeriodDecember" | "AllDatesInPeriodFebruray" | "AllDatesInPeriodJanuary" | "AllDatesInPeriodJuly" | "AllDatesInPeriodJune" | "AllDatesInPeriodMarch" | "AllDatesInPeriodMay" | "AllDatesInPeriodNovember" | "AllDatesInPeriodOctober" | "AllDatesInPeriodQuarter1" | "AllDatesInPeriodQuarter2" | "AllDatesInPeriodQuarter3" | "AllDatesInPeriodQuarter4" | "AllDatesInPeriodSeptember" | "BelowAverage" | "LastMonth" | "LastQuarter" | "LastWeek" | "LastYear" | "NextMonth" | "NextQuarter" | "NextWeek" | "NextYear" | "ThisMonth" | "ThisQuarter" | "ThisWeek" | "ThisYear" | "Today" | "Tomorrow" | "YearToDate" | "Yesterday"): void;
Parameters
- criteriaString
-
"Unknown" | "AboveAverage" | "AllDatesInPeriodApril" | "AllDatesInPeriodAugust" | "AllDatesInPeriodDecember" | "AllDatesInPeriodFebruray" | "AllDatesInPeriodJanuary" | "AllDatesInPeriodJuly" | "AllDatesInPeriodJune" | "AllDatesInPeriodMarch" | "AllDatesInPeriodMay" | "AllDatesInPeriodNovember" | "AllDatesInPeriodOctober" | "AllDatesInPeriodQuarter1" | "AllDatesInPeriodQuarter2" | "AllDatesInPeriodQuarter3" | "AllDatesInPeriodQuarter4" | "AllDatesInPeriodSeptember" | "BelowAverage" | "LastMonth" | "LastQuarter" | "LastWeek" | "LastYear" | "NextMonth" | "NextQuarter" | "NextWeek" | "NextYear" | "ThisMonth" | "ThisQuarter" | "ThisWeek" | "ThisYear" | "Today" | "Tomorrow" | "YearToDate" | "Yesterday"
The dynamic criteria to apply.
Returns
void
Remarks
applyFontColorFilter(color)
Apply a "Font Color" filter to the column for the given color.
applyFontColorFilter(color: string): void;
Parameters
- color
-
string
The font color of the cells to show.
Returns
void
Remarks
applyIconFilter(icon)
Apply an "Icon" filter to the column for the given icon.
applyIconFilter(icon: Excel.Icon): void;
Parameters
- icon
- Excel.Icon
The icons of the cells to show.
Returns
void
Remarks
applyTopItemsFilter(count)
Apply a "Top Item" filter to the column for the given number of elements.
applyTopItemsFilter(count: number): void;
Parameters
- count
-
number
The number of elements from the top to show.
Returns
void
Remarks
applyTopPercentFilter(percent)
Apply a "Top Percent" filter to the column for the given percentage of elements.
applyTopPercentFilter(percent: number): void;
Parameters
- percent
-
number
The percentage of elements from the top to show.
Returns
void
Remarks
applyValuesFilter(values)
Apply a "Values" filter to the column for the given values.
applyValuesFilter(values: Array<string | FilterDatetime>): void;
Parameters
- values
-
Array<string | Excel.FilterDatetime>
The list of values to show. This must be an array of strings or an array of Excel.FilterDateTime
objects.
Returns
void
Remarks
clear()
load(options)
Queues up a command to load the specified properties of the object. You must call context.sync()
before reading the properties.
load(options?: Excel.Interfaces.FilterLoadOptions): Excel.Filter;
Parameters
Provides options for which properties of the object to load.
Returns
load(propertyNames)
Queues up a command to load the specified properties of the object. You must call context.sync()
before reading the properties.
load(propertyNames?: string | string[]): Excel.Filter;
Parameters
- propertyNames
-
string | string[]
A comma-delimited string or an array of strings that specify the properties to load.
Returns
load(propertyNamesAndPaths)
Queues up a command to load the specified properties of the object. You must call context.sync()
before reading the properties.
load(propertyNamesAndPaths?: {
select?: string;
expand?: string;
}): Excel.Filter;
Parameters
- propertyNamesAndPaths
-
{ select?: string; expand?: string; }
propertyNamesAndPaths.select
is a comma-delimited string that specifies the properties to load, and propertyNamesAndPaths.expand
is a comma-delimited string that specifies the navigation properties to load.
Returns
toJSON()
Overrides the JavaScript toJSON()
method in order to provide more useful output when an API object is passed to JSON.stringify()
. (JSON.stringify
, in turn, calls the toJSON
method of the object that is passed to it.) Whereas the original Excel.Filter
object is an API object, the toJSON
method returns a plain JavaScript object (typed as Excel.Interfaces.FilterData
) that contains shallow copies of any loaded child properties from the original object.
toJSON(): Excel.Interfaces.FilterData;
Returns
Office Add-ins