ExcelScript.ConditionalRangeFont interface

Este objeto representa os atributos de fonte (estilo de fonte, cor etc.) para um objeto.

Comentários

Exemplos

/**
 * 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);
}

Métodos

clear()

Redefine os formatos de fonte.

getBold()

Especifica se a fonte é em negrito.

getColor()

Representação de código de cor HTML da cor do texto (por exemplo, #FF0000 representa Vermelho).

getItalic()

Especifica se a fonte é itálica.

getStrikethrough()

Especifica o status de strikethrough da fonte.

getUnderline()

O tipo de sublinhado aplicado à fonte. Confira ExcelScript.ConditionalRangeFontUnderlineStyle detalhes.

setBold(bold)

Especifica se a fonte é em negrito.

setColor(color)

Representação de código de cor HTML da cor do texto (por exemplo, #FF0000 representa Vermelho).

setItalic(italic)

Especifica se a fonte é itálica.

setStrikethrough(strikethrough)

Especifica o status de strikethrough da fonte.

setUnderline(underline)

O tipo de sublinhado aplicado à fonte. Confira ExcelScript.ConditionalRangeFontUnderlineStyle detalhes.

Detalhes do método

clear()

Redefine os formatos de fonte.

clear(): void;

Retornos

void

getBold()

Especifica se a fonte é em negrito.

getBold(): boolean;

Retornos

boolean

getColor()

Representação de código de cor HTML da cor do texto (por exemplo, #FF0000 representa Vermelho).

getColor(): string;

Retornos

string

getItalic()

Especifica se a fonte é itálica.

getItalic(): boolean;

Retornos

boolean

getStrikethrough()

Especifica o status de strikethrough da fonte.

getStrikethrough(): boolean;

Retornos

boolean

getUnderline()

O tipo de sublinhado aplicado à fonte. Confira ExcelScript.ConditionalRangeFontUnderlineStyle detalhes.

getUnderline(): ConditionalRangeFontUnderlineStyle;

Retornos

setBold(bold)

Especifica se a fonte é em negrito.

setBold(bold: boolean): void;

Parâmetros

bold

boolean

Retornos

void

setColor(color)

Representação de código de cor HTML da cor do texto (por exemplo, #FF0000 representa Vermelho).

setColor(color: string): void;

Parâmetros

color

string

Retornos

void

setItalic(italic)

Especifica se a fonte é itálica.

setItalic(italic: boolean): void;

Parâmetros

italic

boolean

Retornos

void

setStrikethrough(strikethrough)

Especifica o status de strikethrough da fonte.

setStrikethrough(strikethrough: boolean): void;

Parâmetros

strikethrough

boolean

Retornos

void

setUnderline(underline)

O tipo de sublinhado aplicado à fonte. Confira ExcelScript.ConditionalRangeFontUnderlineStyle detalhes.

setUnderline(underline: ConditionalRangeFontUnderlineStyle): void;

Parâmetros

Retornos

void