ExcelScript.PresetCriteriaConditionalFormat interface
Stellt das voreingestellte bedingte Format für Kriterien dar, z. B. überdurchschnittlich, unter dem Durchschnitt, eindeutige Werte, enthält "blank", "nonblank", "error" und "noerror".
Hinweise
Beispiele
/**
* This script applies a conditional format that uses a preset criterion.
* Any cell in row 1 will have the color fill set to green if it is a duplicate value
* (of anything else in row 1).
*/
function main(workbook: ExcelScript.Workbook) {
// Get the range for row 1.
const sheet = workbook.getActiveWorksheet();
const formattedRange = sheet.getRange("1:1");
// Add new conditional formatting to that range.
const conditionalFormat = formattedRange.addConditionalFormat(
ExcelScript.ConditionalFormatType.presetCriteria);
// Set the conditional formatting to apply a green fill.
const presetFormat: ExcelScript.PresetCriteriaConditionalFormat = conditionalFormat.getPreset();
presetFormat.getFormat().getFill().setColor("green");
// Set a rule to apply the conditional format when values are duplicated in the range.
const duplicateRule: ExcelScript.ConditionalPresetCriteriaRule = {
criterion: ExcelScript.ConditionalFormatPresetCriterion.duplicateValues
};
presetFormat.setRule(duplicateRule);
}
Methoden
get |
Gibt ein Formatobjekt zurück, das die Schriftart, Füllung, Rahmen und andere Eigenschaften für bedingte Formate kapselt. |
get |
Die Regel des bedingten Formats. |
set |
Die Regel des bedingten Formats. |
Details zur Methode
getFormat()
Gibt ein Formatobjekt zurück, das die Schriftart, Füllung, Rahmen und andere Eigenschaften für bedingte Formate kapselt.
getFormat(): ConditionalRangeFormat;
Gibt zurück
getRule()
Die Regel des bedingten Formats.
getRule(): ConditionalPresetCriteriaRule;
Gibt zurück
setRule(rule)
Die Regel des bedingten Formats.
setRule(rule: ConditionalPresetCriteriaRule): void;
Parameter
Gibt zurück
void
Office Scripts
Feedback
https://aka.ms/ContentUserFeedback.
Bald verfügbar: Im Laufe des Jahres 2024 werden wir GitHub-Issues stufenweise als Feedbackmechanismus für Inhalte abbauen und durch ein neues Feedbacksystem ersetzen. Weitere Informationen finden Sie unterFeedback senden und anzeigen für