ExcelScript.TextConditionalFormat interface

Stellt ein bestimmtes bedingtes Textformat dar.

Hinweise

Beispiele

/**
 * This script adds conditional formatting to the first column in the worksheet.
 * This formatting gives the cells a green fill if they have text starting with "Excel".
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the first column in the current worksheet.
  const currentSheet = workbook.getActiveWorksheet();
  const firstColumn = currentSheet.getRange("A:A");

  // Add conditional formatting based on the text in the cells.
  const textConditionFormat: ExcelScript.TextConditionalFormat = 
    firstColumn.addConditionalFormat(ExcelScript.ConditionalFormatType.containsText).getTextComparison();

  // Set the conditional format to provide a green fill.
  textConditionFormat.getFormat().getFill().setColor("green");

  // Apply the condition rule that the text begins with "Excel".
  const textRule: ExcelScript.ConditionalTextComparisonRule = {
    operator: ExcelScript.ConditionalTextOperator.beginsWith,
    text: "Excel"
  };
  textConditionFormat.setRule(textRule);
}

Methoden

getFormat()

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

getRule()

Die Regel des bedingten Formats.

setRule(rule)

Die Regel des bedingten Formats.

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 Regel des bedingten Formats.

getRule(): ConditionalTextComparisonRule;

Gibt zurück

setRule(rule)

Die Regel des bedingten Formats.

setRule(rule: ConditionalTextComparisonRule): void;

Parameter

Gibt zurück

void