We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Style.getNumber() returns 0 for custom date format "d/m/yyyy"

Hi there,

My application has to deal with the Traditional Chinese MS excel (zh_TW). When I use Style.getNumber() to check on the date format “yyyy/m/d”, it returns 0 which represents “General” type as mentioned in API docs. I’d like to know if there’s any way that the library could return something that represents “Date”? Thanks!


Thanks for providing us some details.

I think you may try to use Style.getCustom() to get the DateTime string if it works for your needs. Moreover, only when the cell’s style is set as built-in number format, the corresponding Style.getNumber() is not 0, however if cell style is set using the custom pattern, the Style.getCustom() will give the custom formatting pattern and Style.getNumber() is useless with value 0. Based on these facts, you should first check if Style.getCustom() is empty, if yes then check the Style.getNumber() value otherwise always use Style.getCustom() method.

Hope, this helps a bit.