Posted 29 May 2018, 11:26 pm EST
We are looking to do something similar to this and we could not find any example where worksheet are moved from one workbook to an other. Our current implementation fails, once we do any action after a copy like this we have error like thi one: Cannot read property ‘Ky’ of null
// mainWorkbookBlob is comming from server as base64 and then converted to blob;
// tempWorkbookBlob is comming from server as base64 and then converted to blob;
let excelIO = new GC.Spread.Excel.IO();
let mainWorkbook = new GC.Spread.Sheets.Workbook();
excelIO.open(mainWorkbookBlob, (json: any) => {
mainWorkbook.suspendPaint();
mainWorkbook.fromJSON(json, null);
}, (e: any) => {
console.log(e);
});
let tempWorkbook = new GC.Spread.Sheets.Workbook();
excelIO.open(tempWorkbookBlob, (json: any) => {
tempWorkbook.suspendPaint();
tempWorkbook.fromJSON(json, null);
mainWorkbook.workbook.addSheet(0, tempWorkbook.getSheet(0));
tempWorkbook.destroy();
}, (e: any) => {
console.log(e);
});
Do you have any advice on how we would implement such feature if there isn’t already an helper function to do this I might have missed.
Thanks