I use Apache POI to write excel sheets. I'm very happy with it, but I have the following problem: my program is multi-currency and internationalized. In the excel sheet I write, I want my currency cells to be properly formatted. For that,
我使用Apache POI编写excel表。我很满意,但我有以下问题:我的程序是多币种和国际化的。在我写的excel表中,我希望我的货币单元格式正确。为了那个原因,
I need a routine that would build the right Excel currency format (eg: "[$$-409]#,##0.00;-[$$-409]#,##0.00") from java.util.Currency and java..util.Locale parameters.
我需要一个例程来构建正确的Excel货币格式(例如:“[$$ - 409]#,## 0.00; - [$$ - 409]#,## 0.00”)来自java.util.Currency和java ..util.Locale参数。
Something like: public String getExcelCurrencyFormat(Currency currency, Locale locale);
类似于:public String getExcelCurrencyFormat(Currency currency,Locale locale);
Is anyone aware of such a library?
有人知道这样的图书馆吗?
1 个解决方案
#1
1
Couldn't you just flag the field as being a currency field, and let Excel figure out the right format to use? Or does Excel require you to specify the format to produce the relevant 'type'?
难道你不能只将该字段标记为货币字段,让Excel找出正确的格式吗?或者Excel是否要求您指定生成相关“类型”的格式?
I would have suggested using java.text.NumberFormat.getCurrencyInstance() but there appears to be no way to get the actual format used by the instance from the object itself (unless tostring() returns it).
我建议使用java.text.NumberFormat.getCurrencyInstance()但似乎没有办法从对象本身获取实例使用的实际格式(除非tostring()返回它)。
Off the top of my head I can't think of anything else sorry.
在我的脑海里,我想不出任何其他的抱歉。
#1
1
Couldn't you just flag the field as being a currency field, and let Excel figure out the right format to use? Or does Excel require you to specify the format to produce the relevant 'type'?
难道你不能只将该字段标记为货币字段,让Excel找出正确的格式吗?或者Excel是否要求您指定生成相关“类型”的格式?
I would have suggested using java.text.NumberFormat.getCurrencyInstance() but there appears to be no way to get the actual format used by the instance from the object itself (unless tostring() returns it).
我建议使用java.text.NumberFormat.getCurrencyInstance()但似乎没有办法从对象本身获取实例使用的实际格式(除非tostring()返回它)。
Off the top of my head I can't think of anything else sorry.
在我的脑海里,我想不出任何其他的抱歉。