Skip to content

Cell value number format

Pierlam-dev edited this page Jan 24, 2026 · 1 revision

What is it?

In Excel the displayed value of a cell has a specific management which is not easy to understand.

If defined, the value is displayed based on a number format which is a string and identified by an id.

Number format is part of the style.

Number format are defined in each sheet.

int format= excelCellValue.NumberFormatId;
string format= excelCellValue.NumberFormat;   

In OpenXml sdk, it's built like this:

Cell     
   int? StyleIndex=null or  set a value -> link to a CellFormat 

Sheet
  List of CellFormat

CellFormat
  NumberFormatId     
  FillId
  FontId
  BorderId

There are 2 kind of number format: built-in and custom.

For built-in ones, there are only Id's, no string number format exists in OpenXml Sdk.

Clone this wiki locally