Changes triggered by clipboard paste

Posted by: afallas on 8 September 2017, 12:54 pm EST

  • Posted 8 September 2017, 12:54 pm EST

    Hi,


    I need to perform some actions when the spread is changed through a paste. I tried using the ClipboardPasting event  but it's fired before the data is actually pasted in the Spread.


    My other option was to use DefaultSheetDataModel.Changed but it gets fired everytime something is changed and I couldn't find a way to filter changes triggered by the user or by code. Is there a way to do this?


    Thanks.

  • Replied 8 September 2017, 12:54 pm EST

    Hello,


    There is not a straight foward way to know changes are being made by Clipboard paste. You can set a flag in the ClipboardPasting event and check the flag in the DefaultSheetDataModel's Changed event.

  • Replied 8 September 2017, 12:54 pm EST

    Thanks. That worked fine. But now I have another problem. I have a grid with initially only one row. The user can paste one or more rows but looks like the  ClipboardPasting is not triggered if the grid doesn't have enough rows to accomodate the text being pasted.  In my ClipboardPasting handler I will increment the number of rows in the grid to make room for the number of rows being pasted.


    Thanks.


     

  • Replied 8 September 2017, 12:54 pm EST

    Hello,


    The ClipboardPasting event is firing for me. Make sure you have the latest maintenance release.

  • Replied 8 September 2017, 12:54 pm EST

    Hello,


    Is not working for me. I have version 3.0.2004.2005


    Let's say I have the code below in a Form with a Spread and I want to paste two lines of text into the grid. The ClipboardPasting is not fired.


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


    FpSpread1.ActiveSheet.RowCount = 1


    FpSpread1.ActiveSheet.ColumnCount = 5


    End Sub


    Private Sub FpSpread1_ClipboardPasting(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.ClipboardPastingEventArgs) Handles FpSpread1.ClipboardPasting


    FpSpread1.ActiveSheet.RowCount += 1


    End Sub

  • Replied 8 September 2017, 12:54 pm EST

    Hello,


    In my tests, this was working. How many columns of data are you trying to paste? I tested with the latest maintenance release (3.0.2005). Could you test with this release and if it still does not work, send us a small zipped project reproducing this issue for us to debug?

  • Replied 8 September 2017, 12:54 pm EST

    I tried with 3.0.2005 and still doesn't work. I'm attaching the code to reproduce the issue. I'm trying to paste two rows, one column of text.


    Thanks


    2007/11/ReproClipboardPasting.zip
  • Replied 8 September 2017, 12:54 pm EST

    Hello,


    It looks like this is a bug in the current release. I was testing with our beta version 4 product where I saw this working. After I saw the issue you are seeing in version 3 (latest maintenance release), I tested with the latest internal build we are testing for the next release and I see this issue has been resolved.

  • Replied 8 September 2017, 12:54 pm EST

    Hi,


    Do you know when the next release will be available? Or can you think of a workaround?


    Thanks,

  • Replied 8 September 2017, 12:54 pm EST

    Hello,


    The next release should be around the middle of January. There is no set date for this release. You can try catching the key stroke to trigger the paste is about to happen and add the row at that time.

Need extra support?

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

Learn More

Forum Channels