- var totalCount = spread.getSheetCount();
- var data = data.entity;
- var spContent = data.Content;
- var tempSpread = new GC.Spread.Sheets.Workbook(document.getElementById("ss1"));
- tempSpread.fromJSON(JSON.parse(spContent));
- tempSpread.getNamedStyles().forEach(function (namedStyle) {
- namedStyle.name = "sc" + totalCount + "_" + namedStyle.name;
- spread.addNamedStyle(namedStyle);
- });
- var sheetCount = tempSpread.getSheetCount();
- for (var j = 0; j < sheetCount; j++) {
- var sheet = tempSpread.getSheet(j);
- sheet.name(sheet.name() + totalCount + "_" + j);
- var sheetJSON = JSON.stringify(sheet.toJSON());
- sheetJSON = sheetJSON.replace(/"style":"/g, '"style":"sc' + totalCount + "_");
- spread.suspendPaint();
- var newSheet = new GC.Spread.Sheets.Worksheet("sheet" + totalCount + "_");
- newSheet.fromJSON(JSON.parse(sheetJSON));
- spread.addSheet(spread.getSheetCount(), newSheet);
- spread.resumePaint();
- }
复制代码 |