ExcelScript.ShowAsRule interface
注釈
例
/**
* The script changes the display for "Crates Sold at Farm".
* The field shows each value's difference
* from the value of the "Lemon" in the same row.
* If the row has no value for "Lemon", the field shows "#N/A".
*/
function main(workbook: ExcelScript.Workbook) {
// Get the PivotTable named "Farm Pivot".
const farmPivot = workbook.getPivotTable("Farm Pivot");
// Get the data hierarchy "Sum of Crates Sold at Farm".
const farmSales = farmPivot.getDataHierarchy("Sum of Crates Sold at Farm");
// Get the row hierarchy "Type".
const typeField = farmPivot.getRowHierarchy("Type").getFields()[0];
// Change the data hierarchy to show each value as the difference
// from the value of the "Lemon" in that row.
const rule: ExcelScript.ShowAsRule = {
calculation: ExcelScript.ShowAsCalculation.differenceFrom,
baseField: typeField,
baseItem: typeField.getPivotItem("Lemon")
}
farmSales.setShowAs(rule);
// Set the name of the field to match the new behavior.
farmSales.setName("Difference from Lemons of Crates Sold at Farm");
}
プロパティ
base |
計算の |
base |
計算の |
calculation |
|
プロパティの詳細
baseField
計算の ShowAs
基となる PivotField (該当する場合は型に従います)。それ以外の ShowAsCalculation
場合 null
は 。
baseField?: PivotField;
プロパティ値
baseItem
計算の ShowAs
基準となる項目 (型に応じて該当する ShowAsCalculation
場合は )。それ以外の場合 null
は 。
baseItem?: PivotItem;
プロパティ値
calculation
ShowAs
PivotField に使用する計算。 詳細は「ExcelScript.ShowAsCalculation
」をご覧ください。
calculation: ShowAsCalculation;
プロパティ値
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
Office Scripts