Hi Team, I have a problem that some rows are missing while pasting to excel,
copy by Ctrl+A and
paste by Ctrl+V from Telerik RadGridView to MS Excel
RadGrid Attributes:
SelectionMode="Extended"
SelectionUnit="Cell"
ClipboardPasteMode="Cells,OverwriteWithEmptyValues"
ClipboardCopyMode="All,Header"
15 Answers, 1 is accepted
I have created a test project to check how the selected rows are pasted into Excel. I could not encounter any problems with empty rows.
Would you please check the attached solution and let me know how is it different from yours?
Didie
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>


I've faced the same issue: if I copy approximately more than 400 rows - few last rows are missing when I paste them to Excel. The more rows I copy - the more are missing ( if 400 rows copied - 1 is missing, if 4000 copied - 10 can be missing). I use VirtualQueryableCollectionView, and load all the data, when user presses Ctrl + A. I also use a behavior for synchronizing selection between grid and collection view.
If I put a break point in event handlers of grid's Copying or Copied events - I can see that all required items are added in SelectedItems collection. But when I paste to Excel - some rows are missing.
You say you use VirtualQueryableCollectionView. May I ask you to test with QueryableCollectionView instead?
Please keep in mind, that generally extended selection with VirtualQueryableCollectionView is only recommended when the selected items are in the View area. It is not possible to actually select items outside it as the items to be eventually displayed are still not presented. This is the case until the user scrolls to a particular position so that the items to be displayed into view are actually loaded.
Regards,
Didie
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Using of QueryableCollectionView is not at all an option. Main reason for using Telerik grid was out of the box virtualization. But we need to give user possibility to select all (or a big amount of data, which are not in the View area). I've made some custom coding to make it work: I track when user presses Ctrl + A, and retrieve everything. Then, when Copying event occurs - I put everything, that I've retrieved earlier, to SelectedItems collection of the grid.
It works for all rows, although they are not in the view, but this bug with few last missing rows appears on larger counts of copied rows.
Also, please note that only rows from the end of selection are missing (few last rows). I can even scroll to the end of the grid, so the specific rows are in the view, when I copy them - but they are still missing when I paste to Excel.
I am sorry to hear you experience such a problem. You say "when Copying event occurs - I put everything, that I've retrieved earlier, to SelectedItems collection of the grid. ". As you have done a custom implementation to make all the items to be actually selected, may I ask you to ensure all the items are still available and copied?
Apart from that, may I ask you to specify the version of our controls are you testing with? Would you please confirm if you can reproduce the issue with the latest version?
Regards,
Didie
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

I'm sure that rows, that are missing, are available and copied. At least, I can see them on the screen and if I debug - after Copied event occurs - they're in SelectedItems collection of the grid.
I'm using the latest version - v2014.1.224.45.
If the items are actually copied and they disappear afterwards, then this seems to be a problem.
May I ask you to send me a demo solution with your specific setup where I can observe the issue? You can take a look at this blog post for a reference on how to isolate an issue.
That way I will be able to advise more specifically.
Regards,
Didie
Telerik

I'm working on isolating the issue, but I'm having troubles with that. As soon as I remove my service layer, and substitute it with a stub, that generates data for the grid - issue is not reproduced any more.
I still hope to find some way to isolate and send you the project, that reproduces the problem, soon, so please don't close this thread. I really need this issue fixed, or workarounded in some way.
Regards,
Yuliya
It will be very helpful if you can send us an isolated case of the issue. You can also perform some tests on the following example from our online github repository: CopyPasteFunctionality.
Regards,
Didie
Telerik

i've the same problem. It's really strange cause the data are copied correctly to the clipboard. All the selectedItems are in the clipboard in different formats (txt, oemtxt, unicodetxt, commaseparatedvalue and html).
I've recognized that excel use html format to copy in its sheets.
I've tried to paste html clipboard to file (successfully), then copy the file content and paste it to excel.. and... it worked! :O
I really don't understand why this happens.. i'll let the telerik team found this aswer.
However, i decided to exclude html format from clipboard in order to let excel paste the txt data.
Amazing... it worked for me. No more traling leaks.
To do that i wrote the following code in the "Copied" event of the grid:
var obj = Clipboard.GetDataObject();
var data = obj.GetData(DataFormats.Text);
Clipboard.SetData(DataFormats.Text, data);
That's all.
I hope this will solve your problem too.
Regards,
Andrea.

It helped me too!


Hello,
I have a little problem with this solution. I need to copy and paste the Bulgarian text from some radgGridView cells. When i changed the Clipboards DataFormats, missing rows are back, but the pasted text from cells where was Bulgarian text appears like #####. Can anybody help me out?
In order to copy the Bulgarian (or any Cyrillic text) properly you will need to use a different format when calling the SetData() method of the Clipboard class. In this case you can use DataFormats.UnicodeText. Here is an example:
Clipboard.SetData(DataFormats.UnicodeText,
"това е СПАРТАААА!!!"
);
Regards,
Martin Ivanov
Progress Telerik