Spread.Sheets Documentation
clipboardPaste Field
Represents the command used for a Clipboard paste on the worksheet.
* The command has a boolean field canUndo that indicates whether the command supports undo and redo operations, and an execute method that performs an execute or undo operation.
* The arguments of the execute method are as follows.
context {GC.Spread.Sheets.Workbook} The context of the operation.
options {Object} The options of the operation.
* options.sheetName {string} The sheet name.
* options.fromSheet {GC.Spread.Sheets.Worksheet} The source sheet.
* options.fromRanges {Array} The source range array which item type is GC.Spread.Sheets.Range.
* options.pastedRanges {Array} The target range array which item type is GC.Spread.Sheets.Range.
* options.isCutting {boolean} Whether the operation is cutting or copying.
* options.clipboardText {string} The text on the clipboard.
* options.pasteOption {GC.Spread.Sheets.ClipboardPasteOptions} The Clipboard pasting option that indicates which content to paste.
isUndo {boolean} true if this is an undo operation; otherwise, false.
Syntax
var value; // Type: clipboardPaste
value = GC.Spread.Sheets.Commands.clipboardPaste;
var clipboardPaste : clipboardPaste;
Example
This example uses the clipboardPaste method.
activeSheet.setValue(0, 0, 1, GC.Spread.Sheets.SheetArea.viewport);
activeSheet.setValue(1, 0, 2, GC.Spread.Sheets.SheetArea.viewport);
activeSheet.setFormula(2, 0, "=A1+A2", GC.Spread.Sheets.SheetArea.viewport);
activeSheet.setValue(0, 1, 3, GC.Spread.Sheets.SheetArea.viewport);
activeSheet.setValue(1, 1, 4, GC.Spread.Sheets.SheetArea.viewport);
activeSheet.setFormula(2, 1, "=B1+B2", GC.Spread.Sheets.SheetArea.viewport);
var fromRange = [new GC.Spread.Sheets.Range(0, 0, 3, 2)];
var toRanges = [new GC.Spread.Sheets.Range(5, 0, 3, 2)];

$("#button1").click(function () {
    //Cut Paste Action
    spread.commandManager().execute({cmd: "clipboardPaste", sheetName: "Sheet1", fromSheet: activeSheet, fromRanges: fromRange, pastedRanges: toRanges, isCutting: true, clipboardText: "", pasteOption: GC.Spread.Sheets.ClipboardPasteOptions.all});
});
$("#button2").click(function () {
    spread.commandManager().execute({cmd: "clipboardPaste", sheetName: "Sheet1", fromSheet: activeSheet, fromRanges: fromRange, pastedRanges: toRanges, isCutting: false, clipboardText: "", pasteOption: GC.Spread.Sheets.ClipboardPasteOptions.all});
});

//Add button controls to page
<input type="button" id="button1" value="button1"/>
<input type="button" id="button2" value="button2"/>
See Also

Reference

Commands type

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.