Export into excel 16 digit number automatically converts i.e(6034620236801017 to 6034620236801020)

Export into excel 16 digit number automatically converts i.e(6034620236801017 to 6034620236801020)

hohulnathvhohulnathv Posts: 2Questions: 1Answers: 0

Hi. while export in to excel, the data which has more than 15 digit number , it is automatically converts .ex: 6034620236801017 to 6034620236801020 . Kindly help me to solve this.
Note : i have worked on below 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] = data.body[i][j] + '\u200C';
}
}
}
}],

It is formatted data as text when export to excel but, above code included special character(Hidden in Excel, copy cell value and paste to Textpad.exe it has "?" ) My client does not want it. Kindly give me a solution. if any alternate, please provide solution.

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    See my answer on this thread, there's a workaround there...

    https://datatables.net/forums/discussion/comment/132522/#Comment_132522

    C

  • hohulnathvhohulnathv Posts: 2Questions: 1Answers: 0

    Hi Colin!. Thanks for the reply.
    i have tried your solution.
    data.body[i][j] = data.body[i][j] + '\u200C';

    but the unicode value --> '\u200C' is represents '?' in TextPad.exe
    (Hidden in Excel, copy cell value and paste to Textpad.exe it has "?" )

    I want to hidden those character while copy the cell value in to TextPad.exe.. please help me!

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Hi @hohulnathv ,

    There's another suggestion further down with an example in Jim Li's comment - it would be worth trying that to.

    Cheers,

    Colin

This discussion has been closed.