Link to home
Create AccountLog in
Avatar of chuang4630
chuang4630

asked on

How to export data to Excel spreadsheet from ASP.NET application?

I am working on a ASP.NET 2.0 application, which requires to export the data to an excel spreadsheet.
It requires:
(1) Tabbed. So need to create multiple tabs. Each tab has its own name.
(2) Might require color coded contents
(3) Requires column name
(4) It will show some special line item, such as sub total (on spread sheet, just show the number) on some of the column. So it is not as easy as export a whole dataset or dataview.

How do I do this? I have seen some examples for winform, but NOT webform. The ideal solution would include the dialog box for user to save or open.

How do I achieve this?
Avatar of jonorossi
jonorossi

You can use use automation to build the document using Excel on the server and send the bytes down to the client to save to their disk like these articles:
http://support.microsoft.com/kb/302084
http://www.codeproject.com/csharp/Simple_Excel_Automation.asp

Or you can get a component that doesn't require excel to be installed on the server and can build excel files in memory in pure 100% managed code like these ones:
http://www.syncfusion.com/products/xlsio/web/default.aspx
http://www.spreadsheetgear.com/products/spreadsheetgear.net.aspx
ASKER CERTIFIED SOLUTION
Avatar of jonorossi
jonorossi

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
I provided chuang4630 a list of products he could use and didn't hear anything back. Either he choose one from the list and didn't close the question or he was happy with the answer but didn't say so. I believe the products I listed would do what was being asked for.
Forced accept.

Computer101
EE Admin