This is a migrated thread and some comments may be shown as answers.

Rows missing while copy from Telerik Rad Grid View and paste at Excel

15 Answers 178 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ramu
Top achievements
Rank 1
Ramu asked on 18 Sep 2013, 01:01 PM
WPF:

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

Sort by
0
Dimitrina
Telerik team
answered on 19 Sep 2013, 03:03 PM
Hi,

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?

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
0
Arnstein
Top achievements
Rank 1
answered on 08 Oct 2013, 01:11 PM
Ramu, did you figure this one out? We have the same issue when copying many rows, 1000+. The last 30-40 rows are not inserted in Excel. 
0
Yuliya
Top achievements
Rank 1
answered on 16 Apr 2014, 12:17 PM
Can you answer this question? 

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.
0
Dimitrina
Telerik team
answered on 18 Apr 2014, 10:07 AM
Hi,

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.

 
0
Yuliya
Top achievements
Rank 1
answered on 18 Apr 2014, 12:12 PM
Hi, Didie,

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.
0
Dimitrina
Telerik team
answered on 18 Apr 2014, 01:02 PM
Hi,

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.

 
0
Yuliya
Top achievements
Rank 1
answered on 22 Apr 2014, 01:07 PM
Hi, Didie,

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.
0
Dimitrina
Telerik team
answered on 22 Apr 2014, 03:37 PM
Hi,

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
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Yuliya
Top achievements
Rank 1
answered on 21 May 2014, 01:37 PM
Hi,

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
0
Dimitrina
Telerik team
answered on 21 May 2014, 01:59 PM
Hi 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
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Andrea
Top achievements
Rank 1
answered on 28 May 2014, 10:45 AM
Hi you all,

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.


0
Yuliya
Top achievements
Rank 1
answered on 02 Jun 2014, 07:44 AM
Thank you, Andrea,

It helped me too!
0
Pe
Top achievements
Rank 1
answered on 30 May 2018, 06:37 AM
Thank you for your solution, it works
0
Pe
Top achievements
Rank 1
answered on 24 Jun 2018, 06:05 PM

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?

0
Martin Ivanov
Telerik team
answered on 26 Jun 2018, 03:18 PM
Hello Pe Ha,

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
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Ramu
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Arnstein
Top achievements
Rank 1
Yuliya
Top achievements
Rank 1
Andrea
Top achievements
Rank 1
Pe
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or