Pasting too many values into too few rows

Posted by: nishanth83 on 8 September 2017, 1:33 pm EST

  • Posted 8 September 2017, 1:33 pm EST



    I have an application where, we allow the first paste of a set of values into a column on the grid. Once pasted, there is validation of the values pasted. If validation succeeds, the application allows the user to paste another set of values into another column.

    If the user pastes too many values the second time than there are rows on the grid, the paste fails because the method Spread_ClipboardPasting or DataModel_Changed don't get called at all. hence, I am not able to control the case where the user pastes too many values the second time. Is there a way to catch that case as well?



  • Replied 8 September 2017, 1:33 pm EST


    You can turn off the InputMap for this keystroke (Ctrl-V). Then, when the user types Ctrl-V, you can catch the key events of Spread and process the keystroke yourself programatically. You can query the Clipboard object for the data and parse the tab delimited data to find the number of columns and rows it would take to paste the data. You can even validata the data at this time. Then, when you ar eready to put the data into the Spread, just call the ClipboardPaste method.

Need extra support?

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

Learn More

Forum Channels