次の方法で共有


ExcelScript.PivotManualFilter interface

PivotField に適用する手動フィルター用の構成可能なテンプレート。 は 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)[]