views:

330

answers:

2

How can I create an Excel sheet with Microsoft.Office.Interop.Excel.dll in ASP.NET?

+1  A: 

Have you considered a 3rd party library e.g. SpreadsheetGear (http://www.spreadsheetgear.com/) or OfficeWriter (http://officewriter.softartisans.com/)? I have used both of these sucessfully on separate projects to export data into complex spreadsheets.

Richard Lennox
A: 

So long as your happy to create .XLSX (xml based spreasheets) you can do this in ASP.NET using the new packaging namespaces that come with .NET, no need to invest in 3rd party vendor solutions...

How to create a spreadsheet document without excel.interop

write and read values into/from cells.

Code snippets for working with open xml office files

Good general coverage of how to manipulate specific files/parts of a open xml file

I should add that in answer to your question using the Microsoft.Office.Interop.Excel namespace is an unsupported and is not recommended for use with server side unattended scenarios such as running in a asp.net worker process. There is numerous coverage of this in ms kb articles. use the above or invest in a 3rd party vendor solution that leverages .net.

Anonymous Type