Posted 21 April 2018, 9:21 am EST
I get an error when i try to save the grid to excel.
JSZip is not a constructor
at Function.e._saveWorkbookToZip (wijmo.xlsx.js?78ca:13)
at Function.e.saveAsync (wijmo.xlsx.js?78ca:13)
at e.saveAsync (wijmo.xlsx.js?78ca:13)
at Function.e.saveAsync (wijmo.grid.xlsx.js?9386:13)
VueJS2 class components (lang=ts)
import JSZip from 'jszip'; //main.ts
//webpack
alias: {
jszip: 'jszip/dist/jszip.min.js'
},
//component
wjXls.FlexGridXlsxConverter.saveAsync(this.GridInstance, { includeColumnHeaders: true, includeCellStyles: false }, 'file.xlsx');
//package.json
"jszip": "^3.1.5",
"script-loader": "^0.7.2",
I am perfectly able to user JSZip despite the error. To test if my import is working ive created a zip file and it gets downloaded when i visit the component.
created(){
var zip:any = new JSZip();
zip.generateAsync({type:"base64"}).then(function (base64:any) {
window.location.href = "data:application/zip;base64," + base64;
});
}