C# Export Excel to client side

J

Jason Huang

Hi,

In my C# Web, I would like to export information from my webpage on to
client's side PC as an Excel file.
I can export to Excel into server without question, but don't know how to
let the Excel file be saved to the client side.
How do I do that?
Thanks for help.


Jason
 
F

Family Tree Mike

Jason Huang said:
Hi,

In my C# Web, I would like to export information from my webpage on to
client's side PC as an Excel file.
I can export to Excel into server without question, but don't know how to
let the Excel file be saved to the client side.
How do I do that?
Thanks for help.


Jason

In response to some action like a download button, you would have code such
as the following:

Response.Clear();
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition","attachment;filename=myfile.xls");
Response.WriteFile("myfile.xls");
Response.End();
 
F

Family Tree Mike

Jeff Johnson said:
Cool, I didn't know that existed.


I don't use it much, but if the file already exists, rather than being
generated in memory, its handy to use.
 
F

Filip

Jason Huang said:
Hi,

In my C# Web, I would like to export information from my webpage on to
client's side PC as an Excel file.
I can export to Excel into server without question, but don't know how to
let the Excel file be saved to the client side.
How do I do that?
Thanks for help.


Jason

Hi Jason,

If you are working application for clients maybe you should worry more about
what if you client doesn't have Microsoft Excel installed. To avoid that you
should use 3rd party component, like GemBox <a
href="http://www.gemboxsoftware.com/GBSpreadsheet.htm>Excel .NET
component</a>.

Filip
 
T

Turgut TEPE

What if client doesn't have excell application ?

Family Tree Mike said:
I don't use it much, but if the file already exists, rather than being
generated in memory, its handy to use.
 

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