Free Support Forum -

Problem with reading formats of Cells with percent

Reading on different cells in an excel worksheet with custom number formats

i got a problem with numbers in ‘percent’.

The cell contains following properties:

in Excel i got:

Numberformat: 0.00%

Value2: 1.2512

Text: 125.12 %

When i read this cell with Aspose.Cells

- CustomStyle is empty.

- CellValue is "1.2512"

- CellText is "125.12%"

How can i get the Numberformat: 0.00% with aspose.cells?


Well, “0.00%” is one of the built-in number format, see the table in the document: So, you may use Cell.Style.Number (instead of Cell.Style.Custom) attribute to get the the number format value (i.e. 10).

Following is my sample code.

Workbook workbook = new Workbook();
Worksheet grid = workbook.Worksheets[0];
Aspose.Cells.Cell cell = grid.Cells[0,0];
MessageBox.Show(cell.Style.Number.ToString()); //10 --> “0.00%”

Thank you.

Thank You