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

RadGridView export to excel (all pages)

5 Answers 663 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Enyi
Top achievements
Rank 1
Enyi asked on 14 Jun 2012, 01:36 PM
Hi, I am using the radgridview with paging using the example below

http://www.telerik.com/community/code-library/winforms/gridview/gridview-paging-using-commandbar.aspx 

I am trying to export the radgridview to excel, however it only exports the current page. How do I export all pages to excel?

Thanks.

5 Answers, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 18 Jun 2012, 06:18 AM
Hello Enyi,

Thank you for writing.

What this Code library project does is it splits the actual data source into several smaller sources and stores them in a dictionary. Every time you select a page it sets a small data source to the grid. The grid does not know its source is a part of a bigger data source, therefore to export all the data you will have to set the whole data source to the grid and export it.

I hope this will be useful. Should you have further questions, I would be glad to help.
 
All the best,
Ivan Petrov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Tobias
Top achievements
Rank 1
answered on 22 Apr 2013, 08:29 AM
Hi,
I have nearly100.000 entries in my datasource. That's why I enabled the paging. But the Excel export needs all the rows.
Is there a common work around to solve this problem?

Thanks!

- Tobias
0
Ivan Petrov
Telerik team
answered on 25 Apr 2013, 07:23 AM
Hello Tobias,

Thank you for writing.

As I have mentioned in my previous post the project from the article takes the grid datasource and splits it in a dictionary. If you are trying to save bandwidth with the paging you are not getting that with this approach. The project still needs the whole data source so it can split it into pages. If you are concerned that the grid cannot load 100 000 items, you shouldn't. Thanks to the grid UI virtualization it can load large data sources and perform well.

To answer your original question you will have to assemble the whole data source again if you want to export it or you can keep a copy of the whole data source. When you get to export it you can create an in-memory RadGridView, assign the full data source to it and export it. You can see an example of that in the comments below the article - link to comment.

I hope this will help. Do not hesitate to write back with further questions.

All the best,
Ivan Petrov
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
0
Rob
Top achievements
Rank 1
answered on 03 Jul 2014, 10:42 AM
Hi Ivan,
What if the Grid uses the RadGridView Filtering to filter the data in the grid?
Once you rebuild the data, you still have to apply the filters to it!
This is a limitation the paging option that is causing me to either do lots more coding, or to stop using it all together.
Are you planning to leave it that way, or is it in the pipelines to fix it?
0
Ivan Petrov
Telerik team
answered on 04 Jul 2014, 03:57 PM
Hello Ahmed,

Thank you for writing.

We have introduced a built-in paging mechanism into RadGridView. It supports exporting of the current or all pages through the PagingExportOption property of ExportToExcelML

I hope this is useful. Feel free to write back with further questions.

Regards,
Ivan Petrov
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.
 
Tags
GridView
Asked by
Enyi
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
Tobias
Top achievements
Rank 1
Rob
Top achievements
Rank 1
Share this question
or