Share via


ExcelScript.ConditionalRangeFont interface

このオブジェクトは、オブジェクトのフォント属性 (フォント スタイル、色など) を表します。

注釈

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

メソッド

clear()

フォントの書式設定をリセットします。

getBold()

フォントが太字かどうかを指定します。

getColor()

テキストの色の HTML カラー コード表現 (たとえば、#FF0000 は赤を表します)。

getItalic()

フォントが斜体かどうかを指定します。

getStrikethrough()

フォントの取り消し線の状態を指定します。

getUnderline()

フォントに適用される下線の種類。 詳細は「ExcelScript.ConditionalRangeFontUnderlineStyle」をご覧ください。

setBold(bold)

フォントが太字かどうかを指定します。

setColor(color)

テキストの色の HTML カラー コード表現 (たとえば、#FF0000 は赤を表します)。

setItalic(italic)

フォントが斜体かどうかを指定します。

setStrikethrough(strikethrough)

フォントの取り消し線の状態を指定します。

setUnderline(underline)

フォントに適用される下線の種類。 詳細は「ExcelScript.ConditionalRangeFontUnderlineStyle」をご覧ください。

メソッドの詳細

clear()

フォントの書式設定をリセットします。

clear(): void;

戻り値

void

getBold()

フォントが太字かどうかを指定します。

getBold(): boolean;

戻り値

boolean

getColor()

テキストの色の HTML カラー コード表現 (たとえば、#FF0000 は赤を表します)。

getColor(): string;

戻り値

string

getItalic()

フォントが斜体かどうかを指定します。

getItalic(): boolean;

戻り値

boolean

getStrikethrough()

フォントの取り消し線の状態を指定します。

getStrikethrough(): boolean;

戻り値

boolean

getUnderline()

フォントに適用される下線の種類。 詳細は「ExcelScript.ConditionalRangeFontUnderlineStyle」をご覧ください。

getUnderline(): ConditionalRangeFontUnderlineStyle;

戻り値

setBold(bold)

フォントが太字かどうかを指定します。

setBold(bold: boolean): void;

パラメーター

bold

boolean

戻り値

void

setColor(color)

テキストの色の HTML カラー コード表現 (たとえば、#FF0000 は赤を表します)。

setColor(color: string): void;

パラメーター

color

string

戻り値

void

setItalic(italic)

フォントが斜体かどうかを指定します。

setItalic(italic: boolean): void;

パラメーター

italic

boolean

戻り値

void

setStrikethrough(strikethrough)

フォントの取り消し線の状態を指定します。

setStrikethrough(strikethrough: boolean): void;

パラメーター

strikethrough

boolean

戻り値

void

setUnderline(underline)

フォントに適用される下線の種類。 詳細は「ExcelScript.ConditionalRangeFontUnderlineStyle」をご覧ください。

setUnderline(underline: ConditionalRangeFontUnderlineStyle): void;

パラメーター

戻り値

void