Free Support Forum - aspose.com

Retrieving format string based on Style.getNumber()

Hello,

I am trying to retrieve the format string based off of the value returned from Style.getNumber(), such as “General” or “#,##0”. In the API documentation there is a table displaying the value/type/format string pairs, but have been unsuccessful finding a method to get the format string. Does such a method exist?

Thanks,
Sean

Hi,


Please use Style.getCustom() method to get the custom number format string of a cell’s style.

Thank you.

I am not referring to a custom number format string, but to one of the default formats in Excel. I am looking for a way to get the format string of the format type associated with the Style.getNumber() method.

Hi,


When you apply numbers formatting for a cell, it’s custom string formatting is also set accordingly in MS Excel. Please try Style.getCustom() and let us know your feedback.

Thank you.

Hi,

In fact ms excel uses different custom string for the same built in number for different locales. We think the better workaround for your requirement is that you gather the custom string in ms excel in your desired locale corresponding every built in number, then you can build the map(or array) in static way and get the corresponding custom string for every built in number when you need.

Thank you.