问题
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 decimal places But actually Only one zero after the decimal point is displayed if the number has no decimal part .
i.e , what I get
`4.56678 =>4.566
4.0 =>4.0
4.1 => 4.000
What I want 4.5667888 =>4.566 4.0 =>4.000 4.1 =>4.000 `
Any help please ?
回答1:
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
来源:https://stackoverflow.com/questions/25427382/setting-a-number-format-pattern-in-ireport-5-7-0-to-retain-3-digits-after-the-de