ExcelScript.NumberFormatCategory enum

数値形式のカテゴリを表します。

注釈

/**
 * This script finds cells in a table column that are not formatted as currency
 * and sets the fill color to red.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the "Cost" column from the "Expenses" table.
  const table = workbook.getTable("Expenses");
  const costColumn = table.getColumnByName("Cost");
  const costColumnRange = costColumn.getRangeBetweenHeaderAndTotal();

  // Get the number format categories for the column's range.
  const numberFormatCategories = costColumnRange.getNumberFormatCategories();

  // If any cell in the column doesn't have a currency format, make the cell red.
  numberFormatCategories.forEach((category, index) =>{
    if (category[0] != ExcelScript.NumberFormatCategory.currency) {
      costColumnRange.getCell(index, 0).getFormat().getFill().setColor("red");
    }
  }); 
}

フィールド

accounting

会計形式は、列の通貨記号と小数点を並びます。

currency

通貨形式は、一般的な通貨値に使用されます。 アカウンティング形式を使用して、列の小数点を揃えます。

custom

任意のカテゴリに含まれていないカスタム形式。

date

日付形式では、日付と時刻のシリアル番号が日付値として表示されます。 アスタリスク (*) で始まる日付形式は、オペレーティング システムに指定されている地域の日付と時刻の設定の変更に対応します。 アスタリスクのない形式は、オペレーティング システムの設定の影響を受けません。

fraction

小数形式では、セル値が整数として表示され、剰余は最も近い小数部の値に丸められます。

general

一般的な書式のセルには、特定の数値形式はありません。

number

数値は、数値の一般的な表示に使用されます。 通貨と会計では、通貨価値に特化した書式設定が提供されます。

percentage

パーセント形式は、セル値に 100 を乗算し、結果をパーセント記号で表示します。

scientific

科学形式では、セル値は 1 から 10 までの数値に 10 の累乗を乗算して表示されます。

special

特殊な形式は、リストとデータベースの値の追跡に役立ちます。

text

数値がセル内にある場合でも、テキスト書式セルはテキストとして扱われます。 セルは、入力したとおりに表示されます。

time

時刻形式では、日付と時刻のシリアル番号が日付値として表示されます。 アスタリスク (*) で始まる時刻形式は、オペレーティング システムに指定されている地域の日付と時刻の設定の変更に対応します。 アスタリスクのない形式は、オペレーティング システムの設定の影響を受けません。