Export excel đuôi xlsx
<script src="~/Content/js/slsx.core.min.js"></script>
<script src="~/Content/js/savefile.js"></script>
<script src="~/Content/js/tableexport.min.js"></script>
//Export kiểu mới
function ShowButtonExport(tableID, fileName) {
TableExport(document.getElementById(tableID), {
headers: true, // (Boolean), display table headers (th or td elements) in the <thead>, (default: true)
footers: true, // (Boolean), display table footers (th or td elements) in the <tfoot>, (default: false)
formats: ["xlsx"], // (String[]), filetype(s) for the export, (default: ['xlsx', 'csv', 'txt'])
filename: fileName, // (id, String), filename for the downloaded file, (default: 'id')
bootstrap: true, // (Boolean), style buttons using bootstrap, (default: true)
exportButtons: true, // (Boolean), automatically generate the built-in export buttons for each of the specified formats (default: true)
position: "bottom", // (top, bottom), position of the caption element relative to table, (default: 'bottom')
ignoreRows: null, // (Number, Number[]), row indices to exclude from the exported file(s) (default: null)
ignoreCols: null, // (Number, Number[]), column indices to exclude from the exported file(s) (default: null)
trimWhitespace: true, // (Boolean), remove all leading/trailing newlines, spaces, and tabs from cell text in the exported file(s) (default: false)
RTL: false, // (Boolean), set direction of the worksheet to right-to-left (default: false)
sheetname: "Sheet1" // (id, String), sheet name for the exported spreadsheet, (default: 'id')
});
TableExport.prototype.charset = "charset=utf-8";
}