0

I am making project with backend as SpringBoot and frontend as thymleaf and Javscript. I am trying to generate to jasper report in which amount will come from the database which is postgres in this project . Please help me and let me know how I will be able to get Amount with Indian Rupee symbol with two zeros after the decimal place in the jasper report eg: ₹ 2000.00 Thanks to all for providing the valuable suggestion

I tried by changing the datatype of Amount column from double to numeric in database to get two zeros after the decimal but it did not solved the problem , value was coming with one zero after decimal place only eg : 2000.0
then to get Rupee symbol with two zeros after decimal place I wrote below code and then set it into the parameter :

parameters.put("TotalAmount",NumberFormat.getCurrencyInstance(new Locale("en","IN")).format(requestfortieuphotels.getTotalAmount()));

but Output came on jasper report as Rs 2000.00
though, two zeros after decimal came but Rupee symbol (₹) did not come .

Please help me to know how to get ₹ 2000.00 as amount in jasperreport.

Alex K
  • 22,315
  • 19
  • 108
  • 236

1 Answers1

0

According to the JDK release notes, you have locale codes hi_IN (Hindi) and en_IN (English).

Try this:

parameters.put("TotalAmount",Currency.getInstance(new Locale("hi", "IN")).getSymbol()+requestfortieuphotels.getTotalAmount()));

Running Code. Please check output

Deepak Gupta
  • 197
  • 1
  • 8