ExcelScript.PivotManualFilter interface
Modèle configurable pour un filtre manuel à appliquer à un champ croisé dynamique. Définit les condition critères à définir pour que le filtre fonctionne.
Remarques
Exemples
/**
* 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
});
}
Propriétés
| selected |
Liste des éléments sélectionnés à filtrer manuellement. Il doit s’agir d’éléments existants et valides du champ choisi. |
Détails de la propriété
selectedItems
Liste des éléments sélectionnés à filtrer manuellement. Il doit s’agir d’éléments existants et valides du champ choisi.
selectedItems?: (string | PivotItem)[];
Valeur de la propriété
(string | ExcelScript.PivotItem)[]