views:

204

answers:

4

Hi All,

What is the best way to export objet to excel file in C# (.net framework 3.5)?

Thanks in advance!

A: 

In the past I've used the clipboard to save objects to multiple formats that can then be pasted into different applications including Excel or Word, tyring to find an example online I stumble across this:

http://support.microsoft.com/kb/306023

Looks Good!

Dog Ears
A: 

If it's tabular data, you could generate HTML tables and let Excel open it up intuitively. Otherwise I'd recommend COM Interop.

code4life
+1  A: 

I've used EPPlus to generate xlsx files (basically reports - SQL Reporting Services 2008 R2 still doesn't support it natively, just the older xls).

I've heard good things about NPOI, which is a .NET port of the Apache POI project

If you want to do it 'natively' and interop with a real instance of Excel, you can use the classes in Excel's Primary Interop Assembly - look in the microsoft.office.interop.excel namespace

A lot depends on what kind of objects you have already and what you want your intended output to be - if you can specify more of that, we can give a more specific answer.

James Manning
A: 

You can read a XLS file with Myxls library, is free and open source, you can see an example in the this url: Myxls example

I you have a question let me know.

majimenezp