Posted 9 April 2018, 2:29 am EST
Hi ,
Can anyone please help on below issue
My requirement is that on click of export button i want to generate two excel , one with formula,one without formula.but its generating only one file.
btnExport() {
var count = 0;
let excelIo = new GC.Spread.Excel.IO();
for (count = 0; count < 2; count++) {
if (count === 0) {
var json = this.spread.toJSON({
includeBindingSource: true,
rowHeadersAsFrozenColumns: true,
columnHeadersAsFrozenRows: true,
ignoreFormula: true,
ignoreStyle: false
});
}
else {
var json = this.spread.toJSON({
includeBindingSource: true,
ignoreFormula: false,
ignoreStyle: false
});
}
let sheetsNames = Object.getOwnPropertyNames(json.sheets);
sheetsNames.forEach(sheetname => {
const option = {
allowFilter: true,
allowSort: true,
allowResizeRows: true,
allowResizeColumns: true,
allowEditObjects: true
};
json.sheets[sheetname].protectionOptions = option;
json.sheets[sheetname].isProtected = false;
}); json.highlightInvalidData = false; let currentSheet = this.spread.getActiveSheet() let currentSheetname = currentSheet.name(); if (count === 0) { currentSheetname = currentSheetname + 'WithHeaders.xlsx'; } else { currentSheetname = currentSheetname + 'WithFormula.xlsx'; } excelIo.save(json, function (blob: any) { FileSaver.saveAs(blob, currentSheetname); }, function (e: any) { }); } }
