Clipboard Paste not override current content

Posted by: vumanhhungtcgl on 2 February 2023, 6:57 am EST

    • Post Options:
    • Link

    Posted 2 February 2023, 6:57 am EST

    I’m trigger ClipboardPaste by event like that to copy data from one workbook to another

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


    It like not working when pasting area is containing value.

    Is there any way to use clipboard paste override current content?

  • Posted 3 February 2023, 2:29 am EST

    Hello,

    The fromRanges and pastedRanges properties of the object provided in commandManager.execute() method take arrays of GC.Spread.Sheets.Range type objects. You may be providing only the range object instead of array of range objects in the code snippet you have provided.

    Please refer to the sample attached below which demonstrates how to manually execute clipboardPaste command with commandManager

    Sample:https://codesandbox.io/s/solution-forked-nffhh6?file=/src/index.js

    Note: Please note that the method described above only works within a workbook and across multiple sheets within that workbook. It does not work across multiple workbooks and spreadjs does not provide any api which programmatically does that. However, you can still perform copy/paste using ctrl+c and ctrl+v which utilizes the external(provided by browsers or system) clipboard.

    Please let us know if you still face any issue regarding this.

    Doc reference

    clipboardPaste command: https://www.grapecity.com/spreadjs/api/v15/modules/GC.Spread.Sheets.Commands#clipboardpaste

    commandManager.execute(): https://www.grapecity.com/spreadjs/api/v15/classes/GC.Spread.Commands.CommandManager#execute

    GC.Spread.Sheets.Range: https://www.grapecity.com/spreadjs/api/v15/classes/GC.Spread.Sheets.Range

    Regards,

    Avinash

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels