Hi
When I use the "default" export buttons, the xlsx files are fine and can be opened in Excel
But if I create my own buttons, and use the script below, I get this message when opening the xlsx file in Excel:
If I click "Yes", the file is fine - but it is a bad experience for the users...
Is this a known problem? And can something be done to fix it?
` var tableId = 'export-buttons-table';
var ExportButtons = document.getElementById(tableId);
var instance = new TableExport(ExportButtons, {
formats: ['xlsx', 'csv'],
trimWhitespace: true,
exportButtons: false
});
// **** jQuery **************************
// $(ExportButtons).tableExport({
// formats: ['xlsx'],
// exportButtons: false
// });
// **************************************
var XLSX = instance.CONSTANTS.FORMAT.XLSX;
var CSV = instance.CONSTANTS.FORMAT.CSV;
// // "id" // format
var exportDataXLSX = instance.getExportData()[tableId][XLSX];
var exportDataCSV = instance.getExportData()[tableId][CSV];
// get filesize
var bytesXLSX = instance.getFileSize(exportDataXLSX.data, exportDataXLSX.fileExtension);
var bytesCSV = instance.getFileSize(exportDataCSV.data, exportDataCSV.fileExtension);
console.log('filesize (XLSX):', bytesXLSX + 'B');
console.log('filesize (CSV):', bytesCSV + 'B');
var XLSXbutton = document.getElementById('customXLSXButton');
XLSXbutton.addEventListener('click', function (e) {
// // data // mime // name // extension
instance.export2file(exportDataXLSX.data, exportDataXLSX.mimeType, exportDataXLSX.filename, exportDataXLSX.fileExtension);
});
var CSVbutton = document.getElementById('customCSVButton');
CSVbutton.addEventListener('click', function (e) {
// // data // mime // name // extension
instance.export2file(exportDataCSV.data, exportDataCSV.mimeType, exportDataCSV.filename, exportDataCSV.fileExtension);
});
Hi When I use the "default" export buttons, the xlsx files are fine and can be opened in Excel But if I create my own buttons, and use the script below, I get this message when opening the xlsx file in Excel:
If I click "Yes", the file is fine - but it is a bad experience for the users... Is this a known problem? And can something be done to fix it?
` var tableId = 'export-buttons-table'; var ExportButtons = document.getElementById(tableId);
`