ExcelScript.PivotManualFilter interface

Настраиваемый шаблон для ручного фильтра, применяемого к сводным полям. Определяет condition , какие критерии необходимо задать, чтобы фильтр работал.

Комментарии

Примеры

/**
 * This script adds a manual filter to a PivotTable. 
 */
function main(workbook: ExcelScript.Workbook)
{
  // Get the first PivotTable in the workbook.
  const pivot = workbook.getPivotTables()[0];

  // Get the hierarchy to use as the filter.
  const location = pivot.getHierarchy("Location");

  // Use "Location" as the FilterHierarchy.
  pivot.addFilterHierarchy(location);

  // Select items for the filter.
  const cityFilter: ExcelScript.PivotManualFilter = {
    selectedItems: ["Seattle", "Chicago"]
  };

  // Apply the filter
  // Note that hierarchies and fields have a 1:1 relationship in Excel, so `getFields()[0]` always gets the correct field.
  location.getFields()[0].applyFilter({
    manualFilter: cityFilter
  });
}

Свойства

selectedItems

Список выбранных элементов для фильтрации вручную. Это должны быть существующие и допустимые элементы из выбранного поля.

Сведения о свойстве

selectedItems

Список выбранных элементов для фильтрации вручную. Это должны быть существующие и допустимые элементы из выбранного поля.

selectedItems?: (string | PivotItem)[];

Значение свойства

(string | ExcelScript.PivotItem)[]