Excel.ShowAsRule interface
Remarques
[ Ensemble d’API : ExcelApi 1.8 ]
Propriétés
base |
PivotField sur lequel baser le |
base |
Élément sur lequel baser le |
calculation | Calcul |
Détails de la propriété
baseField
PivotField sur lequel baser le ShowAs
calcul, le cas échéant en fonction du ShowAsCalculation
type , sinon null
.
baseField?: Excel.PivotField;
Valeur de propriété
Remarques
baseItem
Élément sur lequel baser le ShowAs
calcul, le cas échéant en fonction du ShowAsCalculation
type , sinon null
.
baseItem?: Excel.PivotItem;
Valeur de propriété
Remarques
[ Ensemble d’API : ExcelApi 1.8 ]
Exemples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-calculations.yaml
await Excel.run(async (context) => {
const pivotTable = context.workbook.worksheets.getActiveWorksheet().pivotTables.getItem("Farm Sales");
const farmDataHierarchy: Excel.DataPivotHierarchy = pivotTable.dataHierarchies.getItem("Sum of Crates Sold at Farm");
const wholesaleDataHierarchy: Excel.DataPivotHierarchy = pivotTable.dataHierarchies.getItem("Sum of Crates Sold Wholesale");
farmDataHierarchy.load("showAs");
wholesaleDataHierarchy.load("showAs");
await context.sync();
// Show the difference between crate sales of the "A Farms" and the other farms.
// This difference is both aggregated and shown for individual fruit types (where applicable).
let farmShowAs = farmDataHierarchy.showAs;
farmShowAs.calculation = Excel.ShowAsCalculation.differenceFrom;
farmShowAs.baseField = pivotTable.rowHierarchies.getItem("Farm").fields.getItem("Farm");
farmShowAs.baseItem = pivotTable.rowHierarchies.getItem("Farm").fields.getItem("Farm").items.getItem("A Farms");
farmDataHierarchy.showAs = farmShowAs;
let wholesaleShowAs = wholesaleDataHierarchy.showAs;
wholesaleShowAs.calculation = Excel.ShowAsCalculation.differenceFrom;
wholesaleShowAs.baseField = pivotTable.rowHierarchies.getItem("Farm").fields.getItem("Farm");
wholesaleShowAs.baseItem = pivotTable.rowHierarchies.getItem("Farm").fields.getItem("Farm").items.getItem("A Farms");
wholesaleDataHierarchy.showAs = wholesaleShowAs;
await context.sync();
});
calculation
Calcul ShowAs
à utiliser pour le champ croisé dynamique. Pour plus d’informations, consultez Excel.ShowAsCalculation
.
calculation: Excel.ShowAsCalculation | "Unknown" | "None" | "PercentOfGrandTotal" | "PercentOfRowTotal" | "PercentOfColumnTotal" | "PercentOfParentRowTotal" | "PercentOfParentColumnTotal" | "PercentOfParentTotal" | "PercentOf" | "RunningTotal" | "PercentRunningTotal" | "DifferenceFrom" | "PercentDifferenceFrom" | "RankAscending" | "RankDecending" | "Index";
Valeur de propriété
Excel.ShowAsCalculation | "Unknown" | "None" | "PercentOfGrandTotal" | "PercentOfRowTotal" | "PercentOfColumnTotal" | "PercentOfParentRowTotal" | "PercentOfParentColumnTotal" | "PercentOfParentTotal" | "PercentOf" | "RunningTotal" | "PercentRunningTotal" | "DifferenceFrom" | "PercentDifferenceFrom" | "RankAscending" | "RankDecending" | "Index"
Remarques
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour