C# Export Excel to client side

  • Thread starter Thread starter Jason Huang
  • Start date Start date
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
 
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();
 
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.
 
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
 
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.
 
Back
Top