$(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) ? '\\@' : '';
}}
...
)
Post comment 取消回复