Excel.PivotLabelFilter interface

应用于数据透视字段的标签筛选器的可配置模板。 定义 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

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

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

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

substring?: string;

属性值

string

注解

API 集:ExcelApi 1.12

upperBound

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

upperBound?: string;

属性值

string

注解

API 集:ExcelApi 1.12