Excel.ConditionalColorScaleCriterion interface
Stellt ein Farbskalakriterium dar, das einen Typ, einen Wert und eine Farbe enthält.
Hinweise
Beispiele
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/14-conditional-formatting/conditional-formatting-basic.yaml
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Sample");
const range = sheet.getRange("B2:M5");
const conditionalFormat = range.conditionalFormats
.add(Excel.ConditionalFormatType.colorScale);
const criteria = {
minimum: { formula: null, type: Excel.ConditionalFormatColorCriterionType.lowestValue, color: "blue" },
midpoint: { formula: "50", type: Excel.ConditionalFormatColorCriterionType.percent, color: "yellow" },
maximum: { formula: null, type: Excel.ConditionalFormatColorCriterionType.highestValue, color: "red" }
};
conditionalFormat.colorScale.criteria = criteria;
await context.sync();
});
Eigenschaften
| color | HTML-Farbcodedarstellung der Farbskalafarbe (z. B. #FF0000 steht für Rot). |
| formula | Eine Zahl, eine Formel oder |
| type | Worauf die bedingte Formel des Kriteriums basieren soll. |
Details zur Eigenschaft
color
HTML-Farbcodedarstellung der Farbskalafarbe (z. B. #FF0000 steht für Rot).
color?: string;
Eigenschaftswert
string
Hinweise
formula
Eine Zahl, eine Formel oder null (wenn type ist lowestValue).
formula?: string;
Eigenschaftswert
string
Hinweise
type
Worauf die bedingte Formel des Kriteriums basieren soll.
type: Excel.ConditionalFormatColorCriterionType | "Invalid" | "LowestValue" | "HighestValue" | "Number" | "Percent" | "Formula" | "Percentile";
Eigenschaftswert
Excel.ConditionalFormatColorCriterionType | "Invalid" | "LowestValue" | "HighestValue" | "Number" | "Percent" | "Formula" | "Percentile"