Click here to Skip to main content
15,882,412 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

I am using DataTable to export into Excel.
In one of my cell using a long number which is automatically rounding off when exported to Excel.

This number converted to

I need to keep it as it is.

What I have tried:

                "order": [],
                dom: 'Bfrtip',
                buttons: [
                        extend: 'excel',
                        text: 'Excel',

Updated 17-Nov-20 6:38am
CHill60 17-Nov-20 12:31pm    
I have updated your question to remove the all-capital letters. All capitals is considered to be shouting on the Internet, and is rude. Please remember to use proper case when asking questions in future, more people will be willing to try to help you
faisal23 17-Nov-20 12:35pm    
Thanx buddy
I will.

1 solution

I solved it using the below line of code.

"buttons": [{
           extend: 'excel',
           exportOptions: {
               orthogonal: 'sort'
           customizeData: function ( data ) {
               for (var i=0; i<data.body.length; i++){
                   for (var j=0; j<data.body[i].length; j++ ){
                       data.body[i][j] = '\u200C' + data.body[i][j];
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900