Excel.DateFilterCondition enum

Énumération représentant toutes les conditions acceptées par lesquelles un filtre de date peut être appliqué. Permet de configurer le type de filtre croisé dynamique appliqué au champ.

Remarques

Jeu d’API : ExcelApi 1.12

Utilisateur

Exemples

// 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 date-based PivotFilter.

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

  // PivotFilters can only be applied to PivotHierarchies that are being used for pivoting.
  // If it's not already there, add "Date Updated" to the hierarchies.
  let dateHierarchy = pivotTable.rowHierarchies.getItemOrNullObject("Date Updated");
  await context.sync();
  if (dateHierarchy.isNullObject) {
    dateHierarchy = pivotTable.rowHierarchies.add(pivotTable.hierarchies.getItem("Date Updated"));
  }

  // Apply a date filter to filter out anything logged before August.
  const filterField = dateHierarchy.fields.getItem("Date Updated");
  const dateFilter = {
    condition: Excel.DateFilterCondition.afterOrEqualTo,
    comparator: {
      date: "2020-08-01",
      specificity: Excel.FilterDatetimeSpecificity.month
    }
  };
  filterField.applyFilter({ dateFilter: dateFilter });

  await context.sync();
});

Champs

after = "After"

La date est postérieure à la date du comparateur.

Critères requis : {comparator}. Critères facultatifs : {wholeDays}.

afterOrEqualTo = "AfterOrEqualTo"

La date est postérieure ou égale à la date du comparateur.

Critères requis : {comparator}. Critères facultatifs : {wholeDays}.

allDatesInPeriodApril = "AllDatesInPeriodApril"

La date est en avril.

allDatesInPeriodAugust = "AllDatesInPeriodAugust"

La date est en août.

allDatesInPeriodDecember = "AllDatesInPeriodDecember"

La date est en décembre.

allDatesInPeriodFebruary = "AllDatesInPeriodFebruary"

La date est en février.

allDatesInPeriodJanuary = "AllDatesInPeriodJanuary"

La date est en janvier.

allDatesInPeriodJuly = "AllDatesInPeriodJuly"

La date est en juillet.

allDatesInPeriodJune = "AllDatesInPeriodJune"

La date est en juin.

allDatesInPeriodMarch = "AllDatesInPeriodMarch"

La date est en mars.

allDatesInPeriodMay = "AllDatesInPeriodMay"

La date est en mai.

allDatesInPeriodNovember = "AllDatesInPeriodNovember"

La date est en novembre.

allDatesInPeriodOctober = "AllDatesInPeriodOctober"

La date est en octobre.

allDatesInPeriodQuarter1 = "AllDatesInPeriodQuarter1"

La date est au trimestre 1.

allDatesInPeriodQuarter2 = "AllDatesInPeriodQuarter2"

La date est au 2e trimestre.

allDatesInPeriodQuarter3 = "AllDatesInPeriodQuarter3"

La date est au 3e trimestre.

allDatesInPeriodQuarter4 = "AllDatesInPeriodQuarter4"

La date est au 4e trimestre.

allDatesInPeriodSeptember = "AllDatesInPeriodSeptember"

La date est en septembre.

before = "Before"

La date est antérieure à la date du comparateur.

Critères requis : {comparator}. Critères facultatifs : {wholeDays}.

beforeOrEqualTo = "BeforeOrEqualTo"

La date est antérieure ou égale à la date du comparateur.

Critères requis : {comparator}. Critères facultatifs : {wholeDays}.

between = "Between"

Entre lowerBound et upperBound les dates.

Critères requis : {lowerBound, upperBound}. Critère facultatif : {wholeDays, exclusive}.

equals = "Equals"

Équivaut au critère de comparaison.

Critères requis : {comparator}. Critère facultatif : {wholeDays, exclusive}.

lastMonth = "LastMonth"

La date est le mois dernier.

lastQuarter = "LastQuarter"

La date est le dernier trimestre.

lastWeek = "LastWeek"

La date est la semaine dernière.

lastYear = "LastYear"

La date est l’année dernière.

nextMonth = "NextMonth"

La date est le mois prochain.

nextQuarter = "NextQuarter"

La date est le trimestre suivant.

nextWeek = "NextWeek"

La date est la semaine prochaine.

nextYear = "NextYear"

La date est l’année prochaine.

thisMonth = "ThisMonth"

La date est ce mois-ci.

thisQuarter = "ThisQuarter"

La date est ce trimestre.

thisWeek = "ThisWeek"

La date est cette semaine.

thisYear = "ThisYear"

La date est cette année.

today = "Today"

La date est aujourd’hui.

tomorrow = "Tomorrow"

La date est demain.

unknown = "Unknown"

DateFilterCondition est inconnu ou non pris en charge.

yearToDate = "YearToDate"

La date appartient à la même année à ce jour.

yesterday = "Yesterday"

La date est hier.