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

Export to Excel with GridView

10 Answers 405 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Elver Emilio Cano Cardona
Top achievements
Rank 1
Elver Emilio Cano Cardona asked on 22 Jul 2010, 02:13 PM
Good morning

I have the next case i am using a gridView and i want export a Excel the content the gridView but with exception of any columns. its is possible.. for example i have a GridView with 7 columns and i need export a excel..but only five column of the grid its possible?

public

 

void Export(String sFilepath, RadGridView grvExportExcel)

 

{

 

try

 

{

 

ExportToExcelML exporter = new ExportToExcelML(grvExportExcel);

 

exporter.SummariesExportOption =

SummariesOption.ExportAll;

 

exporter.RunExport(sFilepath);

}

 

catch (Exception)

 

{

 

throw;

 

}

}

Thanks for your help.
Best wish
Elver Cano

10 Answers, 1 is accepted

Sort by
0
Bernd Mueller
Top achievements
Rank 1
answered on 22 Jul 2010, 04:08 PM
Hi,

you can set the DoNotExport Option for hiden Columns:

    exporter.HiddenColumnOption = HiddenOption.DoNotExport

If you set the IsVisible property of the not required columns in the grid to false it should remove them from the export. You can make them visible again after exporting.

Best regards,

Bernd
0
Martin Vasilev
Telerik team
answered on 26 Jul 2010, 05:31 PM
Hello guys,

Bernd is right. The way to exclude columns from an exported RadGridView is to set their IsVisible property to false and use the DonNotExport option for hidden columns in the export method:
 
this.radGridView1.SuspendLayout();
this.radGridView1.Columns[0].IsVisible = false;
ExportToExcelML exporter = new ExportToExcelML(this.radGridView1);
exporter.HiddenColumnOption = HiddenOption.DoNotExport;
exporter.RunExport("c:\\export.xls");
this.radGridView1.Columns[0].IsVisible = true;
this.radGridView1.ResumeLayout(false);


All the best,
Martin Vasilev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Alex Wilson
Top achievements
Rank 1
answered on 21 Sep 2010, 02:14 PM
I am working with Telerik in ASP.net.

Can I provide the Excel worksheet's name ?

Can I merge two radgrids into 1 excel sheet, preferably into two separate worksheets ?

Can I add in rows such as legend into the spreadsheet to accompany the data ?


                                        Alex
0
Martin Vasilev
Telerik team
answered on 24 Sep 2010, 01:55 PM
Hi Alex Wilson,

Thank you for contacting us.

This thread covers only the RadGridView for WinForms control. Please open a new support thread in appropriate ASP.Net section. This will allow those ASP.NET users who are interested in the same topic to find the answer more easily.

All the best,
Martin Vasilev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Daniela
Top achievements
Rank 1
answered on 01 Apr 2011, 12:49 AM
is there any way I can export multiples gridviews in one single excel sheet. I have multiple reports and each report i display it in a gridview. I want to export all gridviews that I have in a page into one single excel sheet.

can this be done ?

thank you
0
Martin Vasilev
Telerik team
answered on 06 Apr 2011, 09:26 AM
Hello Bernd,

Thank you for writing.

We do not support the described feature. We will implement it in a future release if we have more
customers request the same.

Let me know if you have any other questions.

Greetings,
Martin Vasilev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ashish
Top achievements
Rank 1
answered on 12 Sep 2019, 11:13 AM

Dear team,

We are working on ERP and we are finding best tool for our reporting. after research we found Telerik after some requirement full fill after we stuck in export excel sheet. we want all grid to export in single excel file we have tested in PDF there has option for merge but there not good view in PDF because page size fixed. we want in excel please suggest what we can do so that we can continue and final with telerik other wise we have to find another solution. we had checked many user has same requirement from many year ago and hopefully your team do good work for this feature. 

Best Regards

Ashish

0
Dimitar
Telerik team
answered on 13 Sep 2019, 06:19 AM

Hi Ashish,

This is now supported and you can export each grid in a separate sheet. You can use the new exporter and set the FileExportMode property. Detailed information is available here: Export to Excel.

I hope this helps.

Regards,
Dimitar
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Ashish
Top achievements
Rank 1
answered on 16 Sep 2019, 05:34 AM

Hello Dimitar,

Thanks for reply. we want to export all grid in single sheet how we can do.

0
Dimitar
Telerik team
answered on 16 Sep 2019, 08:36 AM

Hello Elver,

This can be achieved by using the SpreadProcessing library. This would require to manually iterate the grids and add the data to the document. There is an example of this in our Demo application (see attached).  

Please let me know if there is something else I can help you with. 

Regards,
Dimitar
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Elver Emilio Cano Cardona
Top achievements
Rank 1
Answers by
Bernd Mueller
Top achievements
Rank 1
Martin Vasilev
Telerik team
Alex Wilson
Top achievements
Rank 1
Daniela
Top achievements
Rank 1
Ashish
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or