In Datatable excel export, decimal values with % symbol are getting rounded off
In Datatable excel export, decimal values with % symbol are getting rounded off
emitsahu077@gmail.com
Posts: 3Questions: 2Answers: 0
in Buttons
exported excel be like
9% 8% 10% 8% 8% 8% 9% 9% 0%
9% 8% 10% 8% 8% 8% 9% 9% 0%
33% 30% 29% 34% 32% 32% 34% 35% 1%
9% 8% 8% 10% 9% 7% 9% 6% -1%
10% 11% 13% 12% 12% 14% 16% 13% 2%
Answers
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Thanks for your response @colin. please refer the below JSFiddle for Test case.
https://jsfiddle.net/nLpoajbz/
If you open the excel from your example and change the precision to 2 decimal places the data is accurate. It's just defaulting to 0 decimal precision.
Also note, If you use CSV and open the CSV file in excel this doesn't happen.
https://jsfiddle.net/gouldner/5f2aLszx/1/
I don't know if this "solves" you issue. Here is a similar example.
https://datatables.net/forums/discussion/44459/how-to-preserve-decimal-places-on-export-to-excel