tags:

views:

1796

answers:

5
+2  Q: 

Export to .xlsx

Hi all,

Could anyone suggest best way to export data to .xlsx format. 1.Dynamically creating sheets. 2.customizing the data in each sheet. We can't use office web components.

Thanks

+1  A: 

You could use a third-party component like Aspose Cells or XLSIO (Syncfusion):

Using Aspose.Cells, developers can easily open and save a multitude of file formats. These include Excel 97 / 2000 / XP / 2007 (XLSX), SpreadSheetML, Tab Delimited and CSV documents. Using Aspose.Cells you can also open encrypted Excel files. It is even possible to convert Excel documents into PDF format by using another Aspose product (that is Aspose.Pdf) alongwith Aspose.Cells.

splattne
+1  A: 

You should have a look at the OpenXML SDK 2.0.

Related blog articles:

0xA3
A: 

Remember also that in many cases a .CSV will do. Excel reads those fine.

You'll only need an XLSX file for Excel-only features like the formatting, multiple worksheets, etc. - and for those, there are a number of existing Excel 1997-2003 generator libraries that make files that'll work with Excel 2007.

ceejayoz
A: 

SpreadsheetGear for .NET can generate XLS and XLSX workbooks and includes a comprehensive API for customizing / formatting the data.

You can see the live ASP.NET Excel Reporting samples here.

Disclaimer: I own SpreadsheetGear LLC.

Joe Erickson
A: 

Excel Package is an open-source (GPL) component for reading/writing Excel 2007 files. I used it on a small project, and the API is straightforward.

The source code also seems well-organized and easy to get around (if you need to expand functionality or fix minor issues as I did).

You can use either approach (customizing a template or creating everything from scratch). Customizing is much easier if you want the result to look nice.

dbkk