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

2.3k Views Asked by At

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>
1

There are 1 best solutions below

0
Thierry Roy On BEST ANSWER

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>