这是我测试的代码逻辑,您可以拷贝到本地进行测试- window.onload = function () {
- var spread = new GC.Spread.Sheets.Workbook("ss");
- spread.setSheetCount(2);
- var sheet0 = spread.getSheet(0);
- sheet0.setValue(0, 0, "test")
- playSpread(spread);
- };
- function playSpread(spread) {
- var rowcount = 10;
- let sheets = spread.getSheet(1);//新
- let tempsheet = spread.getSheet(0); //jiu
- var workbook = spread;
- workbook.options.allowExtendPasteRange = true;
- var fromRange = [new GC.Spread.Sheets.Range(0, 0, 5, rowcount)];
- var toRanges = [new GC.Spread.Sheets.Range(0, 0, rowcount, rowcount)];
- sheets.addRows(0, rowcount - 1);
- workbook.commandManager().execute({
- cmd: "clipboardPaste",
- sheetName: sheets.name(),
- fromSheet: tempsheet,
- fromRanges: fromRange,
- pastedRanges: toRanges,
- isCutting: false,
- clipboardText: "",
- pasteOption: GC.Spread.Sheets.ClipboardPasteOptions.all
- })
- }
- function _getElementById(id) {
- //封装以下方法方便使用
- return document.getElementById(id);
- }
复制代码
|