Posts Tagged ‘Open XML’

Various options to export Excel

December 18, 2012 Leave a comment

First time I worked in generating Excel report, there are different ways to generate the excel file.

1) Using drivers

2) Using Microsoft.Office.Interop.Excel

3) Using Open XML

4) Closed XML (Code plex)

5) EPPlus (code plex)

I tried to export the excel using ‘drivers’ as in ‘Export to excel in ASP.NET‘ but while exporting to export it i have to use Gridview, which is not suitable for my requirment (differentiate  null value and default values).

‘Microsoft.Office.Interop.Excel’ :-

To make use of this dll i have to install VSTO. if office is not installed in the development box or production box i can’t install the VSTO. This also not met my requirement since any of the office product i have to install.

Open XML:-

Using OpenXML it is easy to create EXCEL document and format it. but only drawback for me is have large lines of code. We can overcome by using ‘Open XML SDk 2.0 Productivity Tool‘. This tool reduces the code and it generates the code automatically for the opened excel file template.

This ‘Closed XML‘ helped me to reduce lines of code in exporting data from Dataset to Excel. we can download the ClosedXML from codeplex site. In ClosedXML also use OpenXML dll and as for i used this closedXML is good and easy to use for basic operations.

%d bloggers like this: