ExcelScript.DateFilterCondition enum

表示可应用日期筛选器的所有接受条件的枚举。 用于配置应用于字段的 PivotFilter 的类型。

注解

示例

/**
 * This script applies a filter to a PivotTable that filters out rows 
 * that aren't from this month.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the "Date Recorded" field to filter. 
  // The data in this field must be dates in order for the filter to work.
  const pivot = workbook.getPivotTables()[0];
  const rowHierarchy = pivot.getRowHierarchy("Date Recorded");
  const rowField = rowHierarchy.getFields()[0];

  // Apply the date filter.
  rowField.applyFilter({
    dateFilter: {
      // Setting the condition to `thisMonth` means items that are before or
      // after this month will not be displayed.
      condition: ExcelScript.DateFilterCondition.thisMonth
    }
  });
}

字段

after

日期在比较器日期之后。

必需条件:{comparator}。 可选条件:{wholeDays}

afterOrEqualTo

日期晚于或等于比较器日期。

必需条件:{comparator}。 可选条件:{wholeDays}

allDatesInPeriodApril

日期为 4 月。

allDatesInPeriodAugust

日期为 8 月。

allDatesInPeriodDecember

日期为 12 月。

allDatesInPeriodFebruary

日期为 2 月。

allDatesInPeriodJanuary

日期为 1 月。

allDatesInPeriodJuly

日期为 7 月。

allDatesInPeriodJune

日期为 6 月。

allDatesInPeriodMarch

日期为 3 月。

allDatesInPeriodMay

日期为 5 月。

allDatesInPeriodNovember

日期为 11 月。

allDatesInPeriodOctober

日期为 10 月。

allDatesInPeriodQuarter1

日期位于第 1 季度。

allDatesInPeriodQuarter2

日期位于第 2 季度。

allDatesInPeriodQuarter3

日期位于第 3 季度。

allDatesInPeriodQuarter4

日期位于第 4 季度。

allDatesInPeriodSeptember

日期为 9 月。

before

日期早于比较器日期。

必需条件:{comparator}。 可选条件:{wholeDays}

beforeOrEqualTo

日期早于或等于比较器日期。

必需条件:{comparator}。 可选条件:{wholeDays}

between

介于 和 upperBound 日期之间lowerBound

必需条件: {lowerBoundupperBound}。 可选条件: {wholeDaysexclusive}

equals

等于比较器条件。

必需条件:{comparator}。 可选条件: {wholeDaysexclusive}

lastMonth

日期为上个月。

lastQuarter

日期为上一季度。

lastWeek

日期为上周。

lastYear

日期为去年。

nextMonth

日期为下个月。

nextQuarter

日期为下一季度。

nextWeek

日期为下周。

nextYear

日期为明年。

thisMonth

日期是本月。

thisQuarter

日期是本季度。

thisWeek

日期为本周。

thisYear

日期是今年。

today

日期为今天。

tomorrow

日期为明天。

unknown

DateFilterCondition 未知或不受支持。

yearToDate

日期是同一年至今。

yesterday

日期为昨天。