tags:

views:

228

answers:

5

Generating normal columnar data in excel file is quite easy but does any one of you have generated excel files having datas in different blocks placed in different sheets and beautifully formatted without having to manipulate the excel file using COM [which i want to avoid]. Any ideas would be really helpful.

The output excel file should be compatible with Office 2003 + office 2007

+1  A: 

Check spread sheet gear, with the help of spread sheet gear I have created excel with very good formating as well

http://www.spreadsheetgear.com/

Muhammad Akhtar
+4  A: 

Don't know exactly (as I've Excel installed on both my dev and server machines) but I think ExcelPackage can do the trick.

TheVillageIdiot
Just to expand on this a bit - the answer is that the Excel 2007 formats are "open" and defined, basically being XML wrapped up in a .zip package (bit more to it than that. Microsoft provide tools (System.IO.Packaging) and documentation to help you create documents in this format on the fly without requiring the appropriate application. You can also insert XML data into a document template. The catch is that you end up with an xlsx or docx document - except that this isn't a problem because MS provide compatability tools for Office XP and Office 2k3.
Murph
definitely @Murph it is very right.
TheVillageIdiot
Thanks for this suggestion. I think it will do the job for me just perfectly.
Dom
+1  A: 

If you're not creating many spreadsheets, or don't wish to buy a product which makes this easier, your solution might be to use templates.

Create a excel document, in the style you want, then save it as xml. Then modify the xml document as you like, using place holders or whatever, to generate your documents.

This works for simple reports where you don't want to use a 3rd party product. For anything else I'd recommend a product specializing in this.

Bravax
A: 

You can output to html and use css for formatting: http://stackoverflow.com/questions/440892/how-to-output-an-excel-xls-file-from-classic-asp

Remou
+1  A: 

You can check SmartXLS for .net.

liya