Decimal separator disappers in Excel if value is less than 1000

Decimal separator disappers in Excel if value is less than 1000

abeishabeish Posts: 2Questions: 1Answers: 0

Hi everyone,

I have this strange mistake that shows incorrect values in Excel export. So, if the value in the table is 20,00 it shows 2000 in excel.

This appears to apply to numbers less than 1000. The datatable initialization code is usual as that:

 $("table_id").DataTable({
   "bDestroy": true,
                    "lengthChange": false,
                    "pageLength": 5,
                    "paging": true,
                    "ordering": true,
                    "scrollX": true,
                    "info": true,
                    "order": [[1, 'asc']],
                    "dom": 'Bfrtip',
                    "buttons": [
                                'copyHtml5',
                                'excelHtml5',
                                'print'
                    ],
                     "language": {
                        "decimal": ",",
                        "thousands": "."
                     }
})

Please suggest any ideas on why this problem might be occuring.
Thanks in advance

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @abeish ,

    You said, "if the value in the table is 20,00 it shows 2000 in excel." Was that a typo? Or what would you expect "20,00" to show?

    Cheers,

    Colin

  • abeishabeish Posts: 2Questions: 1Answers: 0

    @colin, no, it's not a typo. I expect to see 20,00 in my excel as well. But for some reason it keeps showing 2000.
    Values in html table itself are all correct.

    Btw, the values in the table are turned into string with a function with the thousands separator as space. So, 25000 becomes 25 000,00 in html table and it shows okay in excel. However, 5,00 turns into 500 in excel. Could that function be a cause of the problem?

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @abeish ,

    I just tried it, see the screenshot below, and the export shows the same data for me as in the table.

    Would you be able to generate a live example please that demonstrates the problem?

    Cheers,

    Colin

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Sorry, @abeish , I totally misread this one - it's a comma decimal place, I was reading that and not taking it on. Apologies. Yep, the excel export doesn't currently support comma decimal places...

    Cheers,

    Colin

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Its something we are aware of and will be addressed in a future update of Buttons.

    Allan

This discussion has been closed.