简体   繁体   中英

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

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

If you are using iReport to create your jrxml. Right click your textfield, go to the "Text Field" tab, and in the Pattern combo box you select #,##0.00 .

Or add the pattern attribute in the field:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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