tags:

views:

620

answers:

5

I need to create an excel file via C#. I have read a few places that creating an XML document is the easiest way to do this? I need to have multiple named tabs and be able to specify that particular cells are text, date time, numeric, etc... Any suggestions or good examples?

+1  A: 

Take a look at NPOI:

http://www.codeplex.com/npoi

This has also been fairly well covered elsewhere on SO:

http://stackoverflow.com/search?q=create+excel+.net

Whisk
+6  A: 

You need the System.IO.Packaging API - this will allow you to generate .xlsx documents as described in Inserting Values into Excel 2007 Cells. The Excel 2007 format can also be used by Excel 2003 and XP with the free Microsoft Office Compatibility Pack installed.

Murph
@wcoenen -nice edits, thanks.
Murph
+1  A: 

you can chech this link

and spreadsheetgear

and CarlosAg Excel Xml Writer Library

astander
The CarlosAg library is good but has limitations and is effectively superceeded by System.IO.Packaging
Murph
and how about spreadsheetgear?
astander
@astander - Spreadsheetgear is somewhat not free and therefore not something I've investigated.
Murph
A: 

We use a suite called Aspose at work. It has a large fully featured "Cells" component that works wonders for us.

mikeschuld