使用模式在Jasper Reports中格式化货币 [英] Formatting currency in Jasper Reports using pattern
本文介绍了使用模式在Jasper Reports中格式化货币的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个查询从表中返回金额:
I have a query which returns amount from a table:
select bus_price from mySchema.BusTable;
这将返回金额,如:
526547
123456
456789.25
12478.35
$ b $我在jasper报告中使用了以上数额。
I am using above amounts in jasper report.
但是,我希望报表中的输出显示为:
However, I want the output in the report to be displayed as:
$526,547.00
$123,456.00
$456,789.25
$12,478.35
JRXML代码片段是:
JRXML code snippet is:
<textField isStretchWithOverflow="true">
<reportElement stretchType="RelativeToTallestObject" x="700" y="0" width="100" height="30"/>
<textElement/>
<textFieldExpression class="java.math.BigDecimal">
<![CDATA[$F{BusPrices}]]>
</textFieldExpression>
</textField>
我知道我必须使用模式。但是,我无法使其工作。
I know I have to use patterns. However, I am not able to make it work.
使用
<textField isStretchWithOverflow="true" pattern='$###,##0.00'>
不工作。
我错过了
感谢阅读!
推荐答案
关闭
<textField pattern="¤ #,##0.00">
应该工作。
¤字符使其成为货币格式。
You need the "¤" character to make it a "currency" format.
如果您使用与您的服务器匹配的版本号下载iReports,您会发现您的选项是什么。
If you download iReports with a version number that matches your server you find out what your options are.
这篇关于使用模式在Jasper Reports中格式化货币的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文