Setting a number format pattern in iReport 5.7.0 to retain 3 digits after the decimal point

前端 未结 1 1358
隐瞒了意图╮
隐瞒了意图╮ 2021-01-27 12:33

I am using iReport 5.7.0 to generate JasperReports\'s report.
I have set the pattern #####0.000 on a field with a Double value.
I have expected 3 dec

相关标签:
1条回答
  • 2021-01-27 12:49

    Try following at the place where you want a particular decimal format. Say you have a field into report, Total_Number:

    new DecimalFormat("#0.000").format($F{Total_number})
    

    If the value for $F{Total_number} is 4.5667888. Following is the output:

    Output

    4.566
    
    0 讨论(0)
提交回复
热议问题