Completed
Last Updated: 12 Oct 2022 06:42 by ADMIN
Release R3 2022 SP2
Martin
Created on: 05 Oct 2022 14:26
Category: UI for WinForms
Type: Bug Report
0
RadGridView: Copy/Paste from Excel to RadGridView fails, resulting in value "System.IO.MemoryStream"

Repro-steps

  1. Create a Form
  2. Add a RadGridView control
  3. Add two Text columns
  4. Run the form
  5. Add a new row to the RadGridView with values "a" and "b"
  6. In Excel fill a row with two cells with values "c" and "d"
  7. Select those cells and copy them to the clipboard
  8. In the RadGridView select the first cell of the row
  9. Paste the data

Expected behavior

  • The values "c" and "d" are in the row

Observed behavior

  • The values "System.IO.MemoryStream" and "b" are in the row

Extra info

If the first column is of another type (like GridViewDecimalColumn) a DataError occurs (because "System.IO.MemoryStream" cannot be parces to a decimal).

 

4 comments
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 11 Oct 2022 13:01

Hi, Martin,

Indeed, the order of parsing the clipboard's content has been changed which is the reason behind the changed behavior. We are currently working on a solution which is expected to be released in the next official service pack. Meanwhile, feel free to cancel the Pasting event for the undesired Format.

Once again, please excuse us for the inconvenience caused.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Martin
Posted on: 08 Oct 2022 11:32

Hi Dess, thanks for your reaction. I am sorry, your solution almost correct.

This is because you've changed your order op using clipboard. CSV is going to be used first now (previously it was HTML) and the CSV pasting operation does not recognize CSV data inside a MemoryStream. So the CSV content should be cancelled.

ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 07 Oct 2022 08:36

Hi, Martin,

I confirm that it is an issue with RadGridView. That is why I have approved this bug report.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to handle the Pasting event that RadGridView offers and cancel pasting other formats than text:

        private void RadGridView1_Pasting(object sender, GridViewClipboardEventArgs e)
        {
            if (e.Format != "Text")
            {
                e.Cancel = true;
            }
        }

Please excuse us for the inconvenience caused. We will do our best to introduce a fix in the upcoming service pack. Meanwhile feel free to us the suggested solution.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Martin
Posted on: 05 Oct 2022 15:15
This worked in version 2022.2.622 of RadGridView.