本帖最后由 Ellia.Duan 于 2024-10-9 17:46 编辑
- const designer = new GC.Spread.Sheets.Designer.Designer(document.getElementById("gc-designer-container"));
- const spread = designer.getWorkbook();
- const sheet = spread.getActiveSheet();
- spread.options.scrollByPixel = true;
- spread.options.scrollbarShowMax = true;
- spread.options.scrollbarMaxAlign = true;
- spread.options.allowExtendPasteRange = true;
- function myClipboardPaste(sheetName,fromSheet,fromRanges,pastedRanges,isCutting,clipboardHtml,clipboardText,clipboardImage,pasteOption) {
- const pasteParams = {
- sheetName: sheetName,
- fromSheet: fromSheet,
- fromRanges: fromRanges,
- pastedRanges: pastedRanges,
- isCutting: isCutting,
- clipboardText: clipboardText,
- pasteOption: pasteOption,
- cmd: "clipboardPaste",
- }
- if (clipboardHtml) {
- pasteParams.clipboardHtml = clipboardHtml;
- }
- if (clipboardImage) {
- pasteParams.clipboardImage = clipboardImage;
- }
- spread.commandManager().execute(pasteParams);
- }
- myClipboardPaste('Sheet1', undefined, undefined,[new GC.Spread.Sheets.Range(1,1,1,1)], false, `"<html xmlns:v="urn:schemas-microsoft-com:vml"
复制代码
(代码中的html和text是从剪切板中解析到的)
复制源:Microsoft Excel
使用快捷键粘贴为一个单元格
使用clipboardPaste 粘贴为两个单元格
|
|