By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,750 Members | 1,471 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,750 IT Pros & Developers. It's quick & easy.

Exporting datagrid to Excel in a Windows Application

P: n/a
Hi all,

I am trying to export the content of a datagrid to Excel format (xls) in
a Windows Application,

I google a bit, but the examples I found were focus on ASP.net, using
the response object, e.g.

HttpResponse response = HttpContext.Current.Response;
response.ContentType = "application/vnd.ms-excel";
How to achieve the same in a C# windows application?

Thanks a lot!
KC Eric
Jun 18 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Eric,

It would be very different. Your best bet is to either use the OLEDB
adapter for Excel/CSV files, or to populate a sheet using Excel automation.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"KC Eric" <kc@nospam.com> wrote in message
news:eb**************@TK2MSFTNGP05.phx.gbl...
Hi all,

I am trying to export the content of a datagrid to Excel format (xls) in
a Windows Application,

I google a bit, but the examples I found were focus on ASP.net, using
the response object, e.g.

HttpResponse response = HttpContext.Current.Response;
response.ContentType = "application/vnd.ms-excel";
How to achieve the same in a C# windows application?

Thanks a lot!
KC Eric

Jun 18 '06 #2

P: n/a
There is .net component call spire.dataexport, I have heard that it is
quite good for generating Excel files. It can create Excel files
without MS Excel installed on the machine,Free download.
http://www.e-iceblue.com
KC Eric 写道:
Hi all,

I am trying to export the content of a datagrid to Excel format (xls) in
a Windows Application,

I google a bit, but the examples I found were focus on ASP.net, using
the response object, e.g.

HttpResponse response = HttpContext.Current.Response;
response.ContentType = "application/vnd.ms-excel";
How to achieve the same in a C# windows application?

Thanks a lot!
KC Eric
Jul 18 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.