$(document).ready(function()
  {
    $('#table').bootstrapTable('refreshOptions', {
        exportOptions: {onMsoNumberFormat: DoOnMsoNumberFormat}
    });
  });
  function DoOnMsoNumberFormat(cell, row, col) {
     return (row > 0 && col == 0) ? '\\@' : '';
  }

ow , the col value is modified according to your column number, and the index starts from 0
So remove the title bar row generally starts from 1, col is based on your own situation, or not judged, all cells are in text format
For \@ , see tableExport.jquery.plugin#options

  • "\@" enforces text format
  • "0" digits without decimals
  • "0.000" digits with three decimal places
  • "0%" percentage without decimals
  • "Percent" percent with two decimal places
  • or direct closure
$('#table').tableExport({type: 'excel', onMsoNumberFormat: function(cell, row, col) {
    return (row > 0 && col == 0) ? '\\@' : '';
  }
});

Of course, for consistency, it is best to write it in the table.bootstrapTable configuration of the js file

table.bootstrapTable({
  ...
   exportOptions: {
            type: 'excel',
           onMsoNumberFormat: function(cell, row, col) {
                return (row > 0 && col == 0) ? '\\@' : '';
           }}
...

)
点赞(3)

评论列表 共有 0 评论

暂无评论

微信服务号

微信客服

淘宝店铺

support@elephdev.com

发表
评论
Go
顶部