Freigeben über


ExcelScript.TopBottomConditionalFormat interface

Stellt ein bedingtes Format oben/unten dar.

Hinweise

Beispiele

/**
 * This sample applies conditional formatting to the currently used range in the worksheet. 
 * The conditional formatting is a green fill for the top 10% of values.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the current worksheet.
  let selectedSheet = workbook.getActiveWorksheet();

  // Get the used range in the worksheet.
  let range = selectedSheet.getUsedRange();

  // Set the fill color to green for the top 10% of values in the range.
  let conditionalFormat = range.addConditionalFormat(ExcelScript.ConditionalFormatType.topBottom)
  conditionalFormat.getTopBottom().getFormat().getFill().setColor("green");
  conditionalFormat.getTopBottom().setRule({
    rank: 10, /* The percentage threshold. */
    type: ExcelScript.ConditionalTopBottomCriterionType.topPercent /* The type of the top/bottom condition. */
  });
}

Methoden

getFormat()

Gibt ein Formatobjekt zurück, das die Schriftart, die Füllung, die Rahmen und andere Eigenschaften des bedingten Formats kapselt.

getRule()

Die Kriterien des bedingten Formats oben/unten.

setRule(rule)

Die Kriterien des bedingten Formats oben/unten.

Details zur Methode

getFormat()

Gibt ein Formatobjekt zurück, das die Schriftart, die Füllung, die Rahmen und andere Eigenschaften des bedingten Formats kapselt.

getFormat(): ConditionalRangeFormat;

Gibt zurück

getRule()

Die Kriterien des bedingten Formats oben/unten.

getRule(): ConditionalTopBottomRule;

Gibt zurück

setRule(rule)

Die Kriterien des bedingten Formats oben/unten.

setRule(rule: ConditionalTopBottomRule): void;

Parameter

Gibt zurück

void