通过


Excel.PivotLabelFilter interface

要应用于 PivotField 的标签筛选器的可配置模板。 定义 condition 需要设置哪些条件才能使筛选器运行。

注解

[ API 集:ExcelApi 1.12 ]

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotfilters.yaml

await Excel.run(async (context) => {
  // Add a PivotFilter to filter based on the strings of item labels.

  // Get the PivotTable.
  const pivotTable = context.workbook.worksheets.getActiveWorksheet().pivotTables.getItem("Farm Sales");

  // Get the "Type" field.
  const field = pivotTable.hierarchies.getItem("Type").fields.getItem("Type");

  // Filter out any types that start with "L" ("Lemons" and "Limes" in this case).
  const filter: Excel.PivotLabelFilter = {
    condition: Excel.LabelFilterCondition.beginsWith,
    substring: "L",
    exclusive: true
  };

  // Apply the label filter to the field.
  field.applyFilter({ labelFilter: filter });

  await context.sync();
});

属性

comparator

比较器是与其他值进行比较的静态值。 比较的类型由 条件定义。 注意:与其他数字字符串进行比较时,数字字符串被视为数字。

condition

指定筛选器的条件,该条件定义必要的筛选条件。

exclusive

如果 true为 ,则筛选器 排除 满足条件的项目。 默认值为 false (筛选器,以包含符合条件) 的项。

lowerBound

筛选条件的范围的 between 下限。 注意:与其他数字字符串进行比较时,数字字符串被视为数字。

substring

用于 、endsWithcontains 筛选条件的beginsWith子字符串。

upperBound

筛选条件的范围 between 上限。 注意:与其他数字字符串进行比较时,数字字符串被视为数字。

属性详细信息

comparator

比较器是与其他值进行比较的静态值。 比较的类型由 条件定义。 注意:与其他数字字符串进行比较时,数字字符串被视为数字。

comparator?: string;

属性值

string

注解

[ API 集:ExcelApi 1.12 ]

condition

指定筛选器的条件,该条件定义必要的筛选条件。

condition: Excel.LabelFilterCondition | "Unknown" | "Equals" | "BeginsWith" | "EndsWith" | "Contains" | "GreaterThan" | "GreaterThanOrEqualTo" | "LessThan" | "LessThanOrEqualTo" | "Between";

属性值

Excel.LabelFilterCondition | "Unknown" | "Equals" | "BeginsWith" | "EndsWith" | "Contains" | "GreaterThan" | "GreaterThanOrEqualTo" | "LessThan" | "LessThanOrEqualTo" | "Between"

注解

[ API 集:ExcelApi 1.12 ]

exclusive

如果 true为 ,则筛选器 排除 满足条件的项目。 默认值为 false (筛选器,以包含符合条件) 的项。

exclusive?: boolean;

属性值

boolean

注解

[ API 集:ExcelApi 1.12 ]

lowerBound

筛选条件的范围的 between 下限。 注意:与其他数字字符串进行比较时,数字字符串被视为数字。

lowerBound?: string;

属性值

string

注解

[ API 集:ExcelApi 1.12 ]

substring

用于 、endsWithcontains 筛选条件的beginsWith子字符串。

substring?: string;

属性值

string

注解

[ API 集:ExcelApi 1.12 ]

upperBound

筛选条件的范围 between 上限。 注意:与其他数字字符串进行比较时,数字字符串被视为数字。

upperBound?: string;

属性值

string

注解

[ API 集:ExcelApi 1.12 ]