Excel.Filter class

管理表格列的筛选。Manages the filtering of a table's column.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

Extends

属性

context

与该对象关联的请求上下文。The request context associated with the object. 这会将加载项的进程连接到 Office 主机应用程序的进程。This connects the add-in's process to the Office host application's process.

criteria

给定列上当前应用的筛选器。The currently applied filter on the given column. 只读。Read-only.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

方法

apply(criteria)

在给定列中应用给定的筛选条件。Apply the given filter criteria on the given column.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyBottomItemsFilter(count)

将“Bottom Item”筛选器应用于列,以获取给定数量的元素。Apply a "Bottom Item" filter to the column for the given number of elements.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyBottomPercentFilter(percent)

将“Bottom Percent”筛选器应用于列,以获取给定比例的元素。Apply a "Bottom Percent" filter to the column for the given percentage of elements.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyCellColorFilter(color)

将“Cell Color”筛选器应用于列,以获取给定颜色。Apply a "Cell Color" filter to the column for the given color.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyCustomFilter(criteria1, criteria2, oper)

将 "Icon" 筛选器应用于列, 以查找给定的条件字符串。Apply an "Icon" filter to the column for the given criteria strings.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyCustomFilter(criteria1, criteria2, operString)

将 "Icon" 筛选器应用于列, 以查找给定的条件字符串。Apply an "Icon" filter to the column for the given criteria strings.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyDynamicFilter(criteria)

将“Dynamic”筛选器应用于列。Apply a "Dynamic" filter to the column.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyDynamicFilter(criteriaString)

将“Dynamic”筛选器应用于列。Apply a "Dynamic" filter to the column.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyFontColorFilter(color)

将“Font Color”筛选器应用于列,以获取给定颜色。Apply a "Font Color" filter to the column for the given color.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyIconFilter(icon)

将 "icon" 筛选器应用于列, 以获取给定图标。Apply an "Icon" filter to the column for the given icon.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyTopItemsFilter(count)

将“Top Item”筛选器应用于列,以获取给定数量的元素。Apply a "Top Item" filter to the column for the given number of elements.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyTopPercentFilter(percent)

将“Top Percent”筛选器应用于列,以获取给定比例的元素。Apply a "Top Percent" filter to the column for the given percentage of elements.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyValuesFilter(values)

将“Values”筛选器应用于列,获取给定值。Apply a "Values" filter to the column for the given values.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

clear()

清除给定列上的 filter。Clear the filter on the given column.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

load(option)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性之前,你必须调用“context.sync()”。You must call "context.sync()" before reading the properties.

load(propertyNames)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性context.sync()之前, 必须先调用。You must call context.sync() before reading the properties.

load(propertyNamesAndPaths)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性context.sync()之前, 必须先调用。You must call context.sync() before reading the properties.

toJSON()

重写 JavaScript toJSON()方法, 以便在将 API 对象传递到时提供更有用的输出JSON.stringify()Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify反过来, 也会调用传递toJSON给它的对象的方法。尽管原始的 Excel. Filter 对象是 API 对象, 但toJSON方法返回一个简单的 JavaScript 对象 (类型为Excel.Interfaces.FilterData, 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.

属性详细信息

context

与该对象关联的请求上下文。The request context associated with the object. 这会将加载项的进程连接到 Office 主机应用程序的进程。This connects the add-in's process to the Office host application's process.

context: RequestContext;

属性值

RequestContext

criteria

给定列上当前应用的筛选器。The currently applied filter on the given column. 只读。Read-only.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

readonly criteria: Excel.FilterCriteria;

属性值

方法详细信息

apply(criteria)

在给定列中应用给定的筛选条件。Apply the given filter criteria on the given column.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

apply(criteria: Excel.FilterCriteria): void;

参数

criteria
Excel.FilterCriteria

要应用的条件。The criteria to apply.

返回

void

applyBottomItemsFilter(count)

将“Bottom Item”筛选器应用于列,以获取给定数量的元素。Apply a "Bottom Item" filter to the column for the given number of elements.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyBottomItemsFilter(count: number): void;

参数

count
number

要显示的底部元素的数量。The number of elements from the bottom to show.

返回

void

applyBottomPercentFilter(percent)

将“Bottom Percent”筛选器应用于列,以获取给定比例的元素。Apply a "Bottom Percent" filter to the column for the given percentage of elements.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyBottomPercentFilter(percent: number): void;

参数

percent
number

要显示的底部元素的百分比。The percentage of elements from the bottom to show.

返回

void

applyCellColorFilter(color)

将“Cell Color”筛选器应用于列,以获取给定颜色。Apply a "Cell Color" filter to the column for the given color.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyCellColorFilter(color: string): void;

参数

color
string

要显示的单元格的背景颜色。The background color of the cells to show.

返回

void

applyCustomFilter(criteria1, criteria2, oper)

将 "Icon" 筛选器应用于列, 以查找给定的条件字符串。Apply an "Icon" filter to the column for the given criteria strings.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyCustomFilter(criteria1: string, criteria2?: string, oper?: Excel.FilterOperator): void;

参数

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.

返回

void

applyCustomFilter(criteria1, criteria2, operString)

将 "Icon" 筛选器应用于列, 以查找给定的条件字符串。Apply an "Icon" filter to the column for the given criteria strings.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyCustomFilter(criteria1: string, criteria2?: string, operString?: "And" | "Or"): void;

参数

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.

返回

void

applyDynamicFilter(criteria)

将“Dynamic”筛选器应用于列。Apply a "Dynamic" filter to the column.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyDynamicFilter(criteria: Excel.DynamicFilterCriteria): void;

参数

criteria
Excel.DynamicFilterCriteria

要应用的动态条件。The dynamic criteria to apply.

返回

void

applyDynamicFilter(criteriaString)

将“Dynamic”筛选器应用于列。Apply a "Dynamic" filter to the column.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

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;

参数

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.

返回

void

applyFontColorFilter(color)

将“Font Color”筛选器应用于列,以获取给定颜色。Apply a "Font Color" filter to the column for the given color.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyFontColorFilter(color: string): void;

参数

color
string

要显示的单元格的字体颜色。The font color of the cells to show.

返回

void

applyIconFilter(icon)

将 "icon" 筛选器应用于列, 以获取给定图标。Apply an "Icon" filter to the column for the given icon.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyIconFilter(icon: Excel.Icon): void;

参数

icon
Excel.Icon

要显示的单元格图标。The icons of the cells to show.

返回

void

applyTopItemsFilter(count)

将“Top Item”筛选器应用于列,以获取给定数量的元素。Apply a "Top Item" filter to the column for the given number of elements.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyTopItemsFilter(count: number): void;

参数

count
number

要显示的顶部元素的数量。The number of elements from the top to show.

返回

void

applyTopPercentFilter(percent)

将“Top Percent”筛选器应用于列,以获取给定比例的元素。Apply a "Top Percent" filter to the column for the given percentage of elements.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyTopPercentFilter(percent: number): void;

参数

percent
number

要显示的顶部元素的百分比。The percentage of elements from the top to show.

返回

void

applyValuesFilter(values)

将“Values”筛选器应用于列,获取给定值。Apply a "Values" filter to the column for the given values.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

applyValuesFilter(values: Array<string | FilterDatetime>): void;

参数

values
Array<string | FilterDatetime>

要显示的值的列表。The list of values to show. 这必须是一个字符串数组或 FilterDateTime 对象的数组。This must be an array of strings or an array of Excel.FilterDateTime objects.

返回

void

clear()

清除给定列上的 filter。Clear the filter on the given column.

[API 集: ExcelApi 1.2][ API set: ExcelApi 1.2 ]

clear(): void;

返回

void

load(option)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性之前,你必须调用“context.sync()”。You must call "context.sync()" before reading the properties.

load(option?: Excel.Interfaces.FilterLoadOptions): Excel.Filter;

参数

返回

注解

除了此签名之外, 此方法还具有以下签名:In addition to this signature, this method has the following signatures:

load(option?: string | string[]): Excel.Filter-Where 选项是一个逗号分隔的字符串或一个字符串数组, 用于指定要加载的属性。load(option?: string | string[]): Excel.Filter - Where option is a comma-delimited string or an array of strings that specify the properties to load.

load(option?: { select?: string; expand?: string; }): Excel.Filter-Where 选项。选择是一个用逗号分隔的字符串, 用于指定要加载的属性和选项。 expand 是一个用逗号分隔的字符串, 用于指定要加载的导航属性。load(option?: { select?: string; expand?: string; }): Excel.Filter - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load.

load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.Filter-仅适用于集合类型。load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.Filter - Only available on collection types. 它类似于前面的签名。It is similar to the preceding signature. top 指定结果中可包含的集合项的最大数量。Option.top specifies the maximum number of collection items that can be included in the result. 选项。 skip 指定要跳过且不包含在结果中的项目数。Option.skip specifies the number of items that are to be skipped and not included in the result. 如果指定了 top 选项, 则在跳过指定数目的项目后将启动结果集。If option.top is specified, the result set will start after skipping the specified number of items.

load(propertyNames)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性context.sync()之前, 必须先调用。You must call context.sync() before reading the properties.

load(propertyNames?: string | string[]): Excel.Filter;

参数

propertyNames
string | string[]

一个以逗号分隔的字符串或字符串数组, 用于指定要加载的属性。A comma-delimited string or an array of strings that specify the properties to load.

返回

load(propertyNamesAndPaths)

将命令加入队列以加载对象的指定属性。Queues up a command to load the specified properties of the object. 在读取属性context.sync()之前, 必须先调用。You must call context.sync() before reading the properties.

load(propertyNamesAndPaths?: { select?: string; expand?: string; }): Excel.Filter;

参数

propertyNamesAndPaths
{ select?: string; expand?: string; }

其中, propertyNamesAndPaths 是用逗号分隔的字符串, 用于指定要加载的属性和 propertyNamesAndPaths。扩展是一个用逗号分隔的字符串, 用于指定要加载的导航属性。Where 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.

返回

toJSON()

重写 JavaScript toJSON()方法, 以便在将 API 对象传递到时提供更有用的输出JSON.stringify()Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify反过来, 也会调用传递toJSON给它的对象的方法。尽管原始的 Excel. Filter 对象是 API 对象, 但toJSON方法返回一个简单的 JavaScript 对象 (类型为Excel.Interfaces.FilterData, 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;

返回