Problem to determine if a cell is in "Currency" format or not

Hi Laurence,

When i read the format of a cell with Cell.Style.Number, i don’t get any difference if a cell is set to “Standard” or to “Currency”. I get “0” in both cases.
I get the same problem if the cell is set to “Time”.

Is there a solution to make the difference between these 3 formats ?

Thanks,

Laurent

Hi Laurent,

MS Excel saves number format in two ways:

  1. A numeric value represents a standard number format. You can check http://www.aspose.com/Products/Aspose.Excel/Api/Aspose.Excel.CellFormat.Number.html for reference.

  2. A custom format string to format numeric data.

If you get 0 in Style.Number, please check the Style.Custom property. It will return the number format string.

If you want to know if a cell is a time value, please use Cell.Type property to determine if it’s a time value.

About the currency value, we don’t have a solution yet. Could you please post your sample file to show your currency format settings?

Thank you.