avoid decimal conversion in excel and cell alignment

avoid decimal conversion in excel and cell alignment

rohan_532rohan_532 Posts: 4Questions: 2Answers: 0

i need to avoid decimal conversion for part no(need it as a whole number without decimal) and also need to align center for some of the excel columns

Answers

  • F12MagicF12Magic Posts: 109Questions: 0Answers: 28

    Cell alignment would require changes to buttons.html5.js , as the styles used in excel are hardcoded in there. I have a modified version which offers left, centered, right and justified alignment. Also rotated 90° and wrapped. Maybe @allan is interested to add these in a future version.

    As for the removal of the decimals, I think you'll have to use the exportOptions of buttons. Something like:

    buttons: [ 
        {
            text: 'Export to XLS',
            extend: 'excelHtml5',
            exportOptions: {
                columns: ':visible',
                format: {
                    body: function( data, row, column, node){
                        return column===1 ? data.replace(/[\.]+/gi,'') : data;
                        }
                }
            }
        }];
    
  • rohan_532rohan_532 Posts: 4Questions: 2Answers: 0

    Thanks F12Magic for your response .

This discussion has been closed.