Exporting datagrid to Excel in a Windows Application

K

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
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 
M

mickwen

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 写é“:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top