ExcelScript.PivotDateFilter interface
PivotField に適用する日付フィルターの構成可能なテンプレート。 は condition
、フィルターを動作させるために設定する必要がある条件を定義します。
プロパティ
comparator | コンパレータは、他の値が比較される静的な値です。 比較の種類は条件によって定義されます。 |
condition | 必要なフィルター条件を定義するフィルターの条件を指定します。 |
exclusive | の場合 |
lower |
フィルター条件の範囲 |
upper |
フィルター条件の範囲の |
whole |
、 |
プロパティの詳細
comparator
コンパレータは、他の値が比較される静的な値です。 比較の種類は条件によって定義されます。
comparator?: FilterDatetime;
プロパティ値
condition
必要なフィルター条件を定義するフィルターの条件を指定します。
condition: DateFilterCondition;
プロパティ値
例
/**
* 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
}
});
}
exclusive
の場合true
、フィルターは条件を満たす項目を除外します。 既定値は (条件を満たす項目を含むフィルター) です false
。
exclusive?: boolean;
プロパティ値
boolean
lowerBound
フィルター条件の範囲 between
の下限。
lowerBound?: FilterDatetime;
プロパティ値
例
/**
* This script applies a filter to a PivotTable that filters it
* to only show rows from between June 20th, 2022 and July 10th, 2022.
*/
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];
// Create the filter's date boundaries.
let earliestDate: ExcelScript.FilterDatetime = {
date: "2022-06-20",
specificity: ExcelScript.FilterDatetimeSpecificity.day
};
let latestDate: ExcelScript.FilterDatetime = {
date: "2022-07-10",
specificity: ExcelScript.FilterDatetimeSpecificity.day
};
// Apply the date filter.
rowField.applyFilter({
dateFilter: {
condition: ExcelScript.DateFilterCondition.between,
lowerBound: earliestDate,
upperBound: latestDate
}
});
}
upperBound
wholeDays
、before
、after
および between
フィルター条件の場合equals
は、全体の日数として比較を行う必要があるかどうかを示します。
wholeDays?: boolean;
プロパティ値
boolean
Office Scripts
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示