fromRanges is null on Commands.clipboardPaste.execute when using Ctrl + C

Posted by: thanh.minh.le on 21 March 2023, 3:47 am EST

    • Post Options:
    • Link

    Posted 21 March 2023, 3:47 am EST - Updated 21 March 2023, 11:52 pm EST

    Hi,

    Currently, we are using fromRanges on GC.Spread.Sheets.Commands.clipboardPaste.execute like this:

    let clipboardPaste = GC.Spread.Sheets.Commands.clipboardPaste.execute
        GC.Spread.Sheets.Commands.clipboardPaste.execute = function (
          context,
          options,
          isUndo
        ) {
    	let { fromRanges } = options
    	....
          clipboardPaste.apply(this, arguments)
        }

    -First use ctrl + c and right-click select ‘Paste’ it works fine.

    -Then right-click select ‘Copy’ then paste using right-click menu.

    -Do copy again with ctrl + c and right-click select ‘Paste’. This time ‘fromRanges’ is null.

    FYI: We are using SpreadJS v14

    So Is there any way to fix it?

    Regards,

    Thanh

  • Posted 22 March 2023, 1:05 am EST

    Hello,

    We were not able to replicate the issue. We tried to replicate the issue by following the steps provided by you. But the fromRanges property always have values whenever the paste operation is performed from context menu of spread.

    It is important to note that whenever Ctrl + c is pressed, the value is stored in internal clipboard of SpreadJS as well as external clipboard(provided by browser). When you use paste option from the context menu of SpreadJS, value is pasted from the internal clipboard of the SpreadJS. That is why fromRanges property is utilized to paste value from specific cell ranges. But when you press Ctrl + V, the external keyboard is given preference to paste value. If external clipboard is empty then value is pasted from internal clipboard.

    Please note that whenever values are pasted from external clipboard, the fromRanges property is null.

    Please refer to the attached sample. You may modify this sample to replicate the issue you are facing.

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

    Please let us know if you face any issues or if you have any doubts regarding how copy/paste operation work in SpreadJS.

    regards,

    Avinash

  • Posted 27 March 2023, 2:39 am EST - Updated 27 March 2023, 3:02 am EST

    Hi, thanks for your reply. But can you provide an example with SpreadJS 14.0.4

    We are currently using 14.0.4 and facing this issue

  • Posted 28 March 2023, 2:52 am EST

    Hello,

    We tried to replicate the issue in SpreadJS v14.0.4 but it was working fine. We did not encounter any issues. The fromRanges property always had value(range object array) whenever we pasted values as per the steps mentioned by you.

    Please refer to the attached sample. You may modify this sample to replicate the issue. This will help us to further investigate the issue and find the root cause.

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

    Regards,

    Avinash

Need extra support?

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

Learn More

Forum Channels