简体   繁体   English

Java代码在jasper报告中以指定格式显示浮点值

[英]java code to display a floating point value in specified format in jasper report

The value 13.10 is printed as 13.1 in my jasper report , I want to print it as 13.10 itself , How to do it .The corresponding JRXML statement is 在我的jasper报告中,值13.10打印为13.1,我想将其打印为13.10本身,如何操作。相应的JRXML语句是

<textFieldExpression class="java.lang.Float"><![CDATA[$F{temp_bill_tax}]]> 
</textFieldExpression>

If you are using iReport to create your jrxml. 如果使用iReport创建jrxml。 Right click your textfield, go to the "Text Field" tab, and in the Pattern combo box you select #,##0.00 . 右键单击您的文本字段,转到“文本字段”选项卡,然后在“模式”组合框中选择#,##0.00

Or add the pattern attribute in the field: 或在字段中添加pattern属性:

<textField ... pattern="#,##0.00"  >
    <textFieldExpression class="java.lang.Float"><![CDATA[$F{temp_bill_tax}]]>/>
</textField>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM