Freigeben über


ExcelScript.ConditionalRangeFont interface

Dieses Objekt stellt die Schriftartattribute (Schriftart, Farbe usw.) für ein Objekt dar.

Hinweise

Beispiele

/**
 * This script applies cell value conditional formatting to a range.
 * Any value less than 60 will have the cell's fill color changed and the font made italic.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the range to format.
  const selectedRange = workbook.getSelectedRange();

  // Add cell value conditional formatting.
  const cellValueConditionalFormatting =
    selectedRange.addConditionalFormat(ExcelScript.ConditionalFormatType.cellValue).getCellValue();

  // Create the condition, in this case when the cell value is less than 60.
  const rule: ExcelScript.ConditionalCellValueRule = {
    formula1: "60",
    operator: ExcelScript.ConditionalCellValueOperator.lessThan
  };
  cellValueConditionalFormatting.setRule(rule);

  // Set the format to apply when the condition is met.
  const format: ExcelScript.ConditionalRangeFormat = cellValueConditionalFormatting.getFormat();
  const fill: ExcelScript.ConditionalRangeFill = format.getFill();
  const font: ExcelScript.ConditionalRangeFont = format.getFont();
  fill.setColor("yellow");
  font.setItalic(true);
}

Methoden

clear()

Setzt die Schriftartformate zurück.

getBold()

Gibt an, ob die Schriftart fett formatiert ist.

getColor()

HTML-Farbcodedarstellung der Textfarbe (z. B. #FF0000 steht für Rot).

getItalic()

Gibt an, ob die Schriftart kursiv ist.

getStrikethrough()

Gibt die durchgestrichene status der Schriftart an.

getUnderline()

Der Auf die Schriftart angewendete Unterstreichungstyp. Weitere Informationen finden Sie unter ExcelScript.ConditionalRangeFontUnderlineStyle .

setBold(bold)

Gibt an, ob die Schriftart fett formatiert ist.

setColor(color)

HTML-Farbcodedarstellung der Textfarbe (z. B. #FF0000 steht für Rot).

setItalic(italic)

Gibt an, ob die Schriftart kursiv ist.

setStrikethrough(strikethrough)

Gibt die durchgestrichene status der Schriftart an.

setUnderline(underline)

Der Auf die Schriftart angewendete Unterstreichungstyp. Weitere Informationen finden Sie unter ExcelScript.ConditionalRangeFontUnderlineStyle .

Details zur Methode

clear()

Setzt die Schriftartformate zurück.

clear(): void;

Gibt zurück

void

getBold()

Gibt an, ob die Schriftart fett formatiert ist.

getBold(): boolean;

Gibt zurück

boolean

getColor()

HTML-Farbcodedarstellung der Textfarbe (z. B. #FF0000 steht für Rot).

getColor(): string;

Gibt zurück

string

getItalic()

Gibt an, ob die Schriftart kursiv ist.

getItalic(): boolean;

Gibt zurück

boolean

getStrikethrough()

Gibt die durchgestrichene status der Schriftart an.

getStrikethrough(): boolean;

Gibt zurück

boolean

getUnderline()

Der Auf die Schriftart angewendete Unterstreichungstyp. Weitere Informationen finden Sie unter ExcelScript.ConditionalRangeFontUnderlineStyle .

getUnderline(): ConditionalRangeFontUnderlineStyle;

Gibt zurück

setBold(bold)

Gibt an, ob die Schriftart fett formatiert ist.

setBold(bold: boolean): void;

Parameter

bold

boolean

Gibt zurück

void

setColor(color)

HTML-Farbcodedarstellung der Textfarbe (z. B. #FF0000 steht für Rot).

setColor(color: string): void;

Parameter

color

string

Gibt zurück

void

setItalic(italic)

Gibt an, ob die Schriftart kursiv ist.

setItalic(italic: boolean): void;

Parameter

italic

boolean

Gibt zurück

void

setStrikethrough(strikethrough)

Gibt die durchgestrichene status der Schriftart an.

setStrikethrough(strikethrough: boolean): void;

Parameter

strikethrough

boolean

Gibt zurück

void

setUnderline(underline)

Der Auf die Schriftart angewendete Unterstreichungstyp. Weitere Informationen finden Sie unter ExcelScript.ConditionalRangeFontUnderlineStyle .

setUnderline(underline: ConditionalRangeFontUnderlineStyle): void;

Parameter

Gibt zurück

void