您好,将Demo中指定代码修改如下即可:
document.querySelector("#paste").addEventListener("click", function () {
let selections = sheet.getSelections();
let sheetName = sheet.name();
spread.commandManager().execute({
cmd: "clipboardPaste",
sheetName: sheetName,
fromSheet: clipboardHelper.copiedSheet,
fromRanges: clipboardHelper.copiedRanges,
pastedRanges: selections,
isCutting: false,
clipboardText: "",
pasteOption: GC.Spread.Sheets.ClipboardPasteOptions.all,
});
let spans = sheet.getSpans(selections[0]);
console.log(spans);
let range = sheet.getRange(
selections[0].row,
spans[0].col,
selections[0].rowCount,
spans[0].colCount
);
range.clear(GC.Spread.Sheets.StorageType.data);
range.clear(GC.Spread.Sheets.StorageType.style);
});
|