首先,iReport需要这个问题。我必须用逗号替换点号。我的问题是数据库中的字段类型为BigDecimal,因此不存在任何替换方法。所以我将类型更改为String,但随后收到以下消息:
it.businesslogic.ireport.gui.logpane.ProblemItem@820dc5 The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
我的代码如下所示:
new String($F{gewicht}.toString()).replace(".",",")
我能做什么?
您可以使用文本字段模式:
<textField pattern="#,##0.00 €">
这将为您提供德语格式。在这种情况下,这是针对€值的,但是如果需要,您可以跳过€并添加更多小数:
<textField pattern="#,####0.0000">
另一种方法是:
new DecimalFormat("#,##0.00 €", new DecimalFormatSymbols(Locale.GERMANY)). format(Double.parseDouble($F{gewicht}))
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句