How to specify Copy and Cut event

Posted by: longv.dev on 15 November 2022, 9:27 pm EST

  • Posted 15 November 2022, 9:27 pm EST

    _ In SpreadJS, I’m using ClipboardChanging event to track Copy/Cut action but I can’t specify which is which, is there any properties that I can specify an event is a Cut or a Copy event?

    _ When I set sheet.options.isProtected to “true”, how can I allow format cell in the code?

  • Posted 17 November 2022, 6:48 am EST

    Hi,

    With the latest version of SpreadJS V15.2.5, you can get the “isCutting” property in the ClipboardChanging Event. You could use the “isCutting” property to judge the if it’s a cut or a copy action. You can refer to the following code snippet:

        spread.bind(GC.Spread.Sheets.Events.ClipboardChanging, function(sender, args) {
            if(args.isCutting) {
                console.log("Cut Action");
            } else {
                console.log("Copy Action");
            }
        })

    Sample: https://jscodemine.grapecity.com/share/nFJW4WGKA0mrl0e54etTWA/

    If you are using the previous version of SpreadJS, you could overwrite the cut command and maintain a state if the cut action is performed. Please refer to the following sample: https://codesandbox.io/s/tender-banach-jbvhx2?file=/src/index.js

    Currently, formatting cells is not allowed when you have the sheet protection allowed. You need to unprotect the sheet to allow format cell. For SpreadJS Designer component, it internally maintains a state to allow the Format Cells.

    You could refer to the following docs for all the protection options available: https://www.grapecity.com/spreadjs/docs/features/worksheet/celllock#site_main_content-doc-content_title

    Regards,

    Ankit

Need extra support?

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

Learn More

Forum Channels