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

Copy and paste to exel

1 Answer 127 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mattia
Top achievements
Rank 2
Mattia asked on 11 Mar 2015, 04:21 PM
Hi,
When I try to copy a lot of data from my grid to the excel sheet, some rows are missing.

I found this solution on your forum

private void gridview_Copying(object sender, RadRoutedEventArgs e)
{
var obj = Clipboard.GetDataObject();
           var data = obj.GetData(DataFormats.Text);
           Clipboard.SetData(DataFormats.Text, data);
...
}

All data now are copied to excel but if into a cell there is a newline char, excel will create a new row
How can I fix it?

Another question..
I read that when I copy from grid on the clipboard all data are saved as html, csv and txt
My grid has around 500 000 cells, and the coping operation is not performed at all.
I think the problem is the html, and I need only the data without any kind of formatting.
So is it possible to saved only the txt on the clipboard?

Thanks

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 12 Mar 2015, 01:08 PM
Hello Stefania,

It is a bit strange that not all of the items are copied. Do you work with VirtualQuerableCollectionView so that not all of the objects are loaded ?
Considering the code, my suggestion would be to implement the logic in Copied event instead. Once you get the data from the clipboard, you can manipulate it and remove all unwanted characters. 
As for your last question, I am not entirely sure what is going on. Could you try Microsoft DataGrid - are the items copied ? Are the Copying/Copied events of RadGridView thrown ?  


Regards,
Maya
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.

 
Tags
GridView
Asked by
Mattia
Top achievements
Rank 2
Answers by
Maya
Telerik team
Share this question
or