Dr. John Tunicliffe wrote a nice class for creating excel 2007 spreadsheets and was nice enough to post his work on the codeplex web site.
http://www.codeplex.com/ExcelPackage
I was looking to use the ExcelPackage to create a spreadsheet on a website with out having to save the spreadsheet on the server first. Well to do this we are going to have to modify the ExcelPackage class to have an constructor which accepts a stream. After you download the ExcelPackage class from codeplex add the following code to ExcelPackage.cs contructors region.
#region ExcelPackage Constructors
/// <summary>
/// Creates a new instance...
For this example we are going to create a Excel 2007 spreadsheet using the Microsoft OpenXml Sdk and Linq to XML.
To start with lets create a new Windows forms app which targets the .Net Framework 3.5. Add a Linq to Sql design surface to your project and name it Northwind and drag the Northwind Products table on to the surface. On the windows form I added a DataGridview to display the data we are going to export to excel. We also need a button named btnExport on the form.
To create a excel spreadsheet we need to use the...