Raise your hands if you enjoy the power of "Zero Code" ? That's everyone. Thanks to ASP.NET 2.0. Most of the heavy lifting is done by the framework.
I would like to present to you a new custom control that I developed. This control "Exports" the contents of your "GridView" into Excel format with "Zero Code". That's right. Simply drag and drop and you are all set.
Copyright (c) Rajesh Krishnamohan. All rights reserved.
This software is provided "AS IS", without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Export Gridview to Excel
1) Styling : If you used "HeaderStyle", "RowStyle", "AlternateRowStyle" in your GridView, you can simply enable styling by setting the "ApplyStyleInExcel' property to "True". Note: CSS styling is
not supported at this point
2) TimeStamp: If you set the "IncludeTimeStamp" to true, the filename is appended with a "time Stamp". These are very useful for time sensitive reports.
3) PageSize: If you are using Pagination in your GridView, you can choose to export the "Current" page, the "Entire Grid"
all pages or set a specific number of records to export. Use "All" for all pages, "Current" for the current page and 20 for first 20 records.
4) Sorting: The Export supports sorting. In otherwords, if you sort your gridview and then export, the excel spreadsheet will also be sorted.
5) GridViewID: If you have more than one gridview in a page, you can specify which gridview you'd like to export by setting this property. You do not have to set any value if you just have one grid view.
6) FileName: You can set the filename that you want to export.
7) EnableHyperLinks: If set to "True" the exported excel file will have "Live" links. If set to "False", only the text will be exported.
Alpha 1.1 release feature
Following are NEW in BETA version***
8) Charset - Allows you to setup a Charset Multi-lingual support
9) ContentEncoding - Allows you to set the Encoding Multi-lingual support
10) ColumnsToExclude - Allows you to input the columns comma separated that you'd like to exclude in your export.
11) PreExport Event - For those of you who dynamically bind the GridView at runtime, use this new event to databind the GridView just before "Exporting"
******Following are NEW additions added on 3/24/2011 to the BETA version
The following addtions compelled me to upgrade the component to .NET 3.5. The features added below uses System.IO.Packaging namespace for compression.
12) ZipTheFile - if set to True, compresses the generated file into Zip file and saves download bandwidth
13) ZipMode - choose between Fast, Maximum, Normal, SuperFast and get the desired results.
Simply drag and drop the ExportToExcel button on your page and enjoy "Zero code" export feature.