Problem using CopyRange in version 12 WinForms

Posted by: michaelc on 13 November 2020, 4:51 am EST

  • Posted 13 November 2020, 4:51 am EST

    I'm upgrading an old winform application and have run into a snag.
    The code simply copies 5 rows from the top of the sheet and paste then at assigned row with all formatting. This has worked in all previous version. Below is the error. Any help would be greatly appreciated.

    Form1.FpSpread1.Sheets(x).CopyRange(0, 0, z, 0, 5, 13, False)

    System.InvalidOperationException
    HResult=0x80131509
    Message=We can't do that to a merged cell.
    Source=FarPoint.Win.Spread
    StackTrace:
    at t2.a(String A_0, Type A_1)
    at FarPoint.Win.Spread.Model.WorksheetDataModel.CopyInternal(Int32 fromRow, Int32 fromColumn, Int32 toRow, Int32 toColumn, Int32 rowCount, Int32 columnCount, ManipulationOptions options, Boolean dataModelDataOnly, Boolean& processedWorksheet)
    at FarPoint.Win.Spread.SheetView.a(Int32 A_0, Int32 A_1, Int32 A_2, Int32 A_3, Int32 A_4, Int32 A_5, f1 A_6, Boolean A_7, Boolean A_8, Dictionary`2& A_9, Dictionary`2& A_10, Dictionary`2& A_11)
    at FarPoint.Win.Spread.SheetView.CopyRange(Int32 fromRow, Int32 fromColumn, Int32 toRow, Int32 toColumn, Int32 rowCount, Int32 columnCount, Boolean dataOnly)
    at VulcanEBOM.Module1.UpdateShipWeight() in Module1.vb:line 1337
    at VulcanEBOM.Form1.FpSpread1_CellDoubleClick(Object sender, CellClickEventArgs e) in Form1.vb:line 9792
    at FarPoint.Win.Spread.FpSpread.OnCellDoubleClick(CellClickEventArgs e)
    at FarPoint.Win.Spread.FpSpread.a(SpreadView A_0, Int32 A_1, Int32 A_2, Int32 A_3, Int32 A_4, MouseButtons A_5, Boolean A_6, Boolean A_7, Boolean A_8, Int32 A_9, Int32 A_10)
    at FarPoint.Win.Spread.SpreadView.a(Int32 A_0, Int32 A_1, MouseEventArgs A_2)
    at FarPoint.Win.Spread.SpreadView.g(MouseEventArgs A_0)
    at FarPoint.Win.Spread.FpSpread.OnMouseDown(MouseEventArgs e)
    at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at FarPoint.Win.Spread.FpSpread.WndProc(Message& m)
  • Marked as Answer

    Replied 16 November 2020, 11:48 pm EST

    Hi Michael.

    It seems like the merged cells present on your sheets are causing this issue and also I am not sure what cell type/style you are using. However, I have tried the same with the latest spread build i.e Spread 14 and it is working fine at my end.

    https://www.grapecity.com/spread/download-product

    Could you please try the same with the latest spread build and share your observations with us?

    Just in case needed I have also attached a sample. If possible please make the necessary changes to the attached sample to replicate the behavior.

    Regards,
    Kartik

    SpreadCopyRange.zip
  • Replied 17 November 2020, 5:31 am EST

    Kartik,

    Thank you for the response. I can confirm that v14 works without issue.
Need extra support?

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

Learn More

Forum Channels