I have created a report using a word (docx) document as the template and I am trying to format the numbers using #,##0,## however the output uses # format instead. How can I fix this I used the value format in the report editor.
Your pattern seems incorrect, may be instead of last
, should be
#,##0.##)? Problem may be caused by default locale of your java. Symbol
, means grouping separator in pattern string, but in different locales this separator can be different characters. May be in your locale this character is space, then formatted number
12345678 will be like
12 345 678. If it is not the case, could you please provide example of formatted number and version of Cuba platform in your project? Exported sample report will also help.
I made sure it is using the same as you said as I was using one from available parameters. I have uploaded a copy of the report.
Receipt PDF.zip (92.6 KB)
To format numbers we use standard
java.text.DecimalFormat and it should use your default locale. You could try to check what will happen when formatting numbers with
DecimalFormat, the result should not differ from the one in the report.
The problem may be in
DecimalSeparator characters. You could get default locale using
Locale.getDefault() method. Could you check which values
getCountry() methods of default
Locale instance will return?
Locale defaultLocale = Locale.getDefault();
Then I can check which characters
DecimalFormat will use and perform some formatting tests.
I have used the functions as requested here is the results
defaultLocale.getDisplayCountry(); United States
I’ve performed some tests with your locale parameters and copy of your report, but problem is not reproduced. Numbers formatted as expected.
Could you please provide sample project with repoduced problem?