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?
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.
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.
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.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.