Question posted 2012 · +6 upvotes
Possible Duplicate:
Generating an Excel file in ASP.NET
Here’s my question: How do you programmatically create a “true” Excel file?
Note: I don’t mean a CSV, HTML/CSS, or XML file, I mean a file written in the same format Excel uses to save spreadsheets.
Background: I’m working on an ASP.Net application, which includes Telerik’s RadGrid. We’re currently using the RadGrid’s ExportToExcel() function, but some of our customers need to be able to view these exports using Excel Viewer. Telerik’s function exports an HTML/CSS-based file, which the full-version of Excel can open, but Excel Viewer cannot.
I’m sure its possible to programmatically create a “true” Excel file, but I’m not sure where to begin. Is there an SDK which could help me do this?
Any suggestions would be appreciated. Thanks in advance.
Accepted answer +10 upvotes
You can use the interop from Excel like RedFilter showed you, but there are also open source alternatives that does not require Excel to be installed on your pc to work. It can be useful if you have a asp.net project deployed on a server that does not have Excel.
EPPlus is a good library. http://epplus.codeplex.com/
Personnally, I use Koogra. http://sourceforge.net/projects/koogra/?_test=b
External references cited (2)
- epplus.codeplex.com — http://epplus.codeplex.com/
- sourceforge.net — http://sourceforge.net/projects/koogra/?_test=b
Top excel Q&A (6)
- Shortcut to Apply a Formula to an Entire Column in Excel +335 (2011)
- How should I escape commas and speech marks in CSV files so they work in Excel? +136 (2012)
- Convert xlsx to csv in linux command line +96 (2012)
- How to create a link inside a cell using EPPlus +50 (2011)
- IF statement: how to leave cell blank if condition is false ("" does not work) +44 (2013)
- T-SQL: Export to new Excel file +44 (2012)
excel solutions on this site
.