This control, allows you to "Export" the contents of your "GridView" control to Excel {no coding required}.
Usage
Simply drag and drop the ExportToExcel button on your page and enjoy "Zero code" export feature.
Features:
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 {future release}
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) File Name: You can set the filename that you want to export.
A detailed article about Export to Excel which includes common problems faced during the export task, adding styling to the exported document and disabling unwanted controls from the GridView control.
Two questions: is GridView exported as HTML or as a xls\xlsx file? What excel file formats does this control supports?
So far I am using this
Excel C# / VB.NET library for my
Excel ASP.NET applications and it has proved quite good because it doesn't use Excel Interop, supports various excel formats (xls, xlsx, ods, csv) and has clean and nice to use API.
Member
10 Points
37 Posts
Free:Export Gridview to Excel
Oct 07, 2007 11:15 AM|sendemailtorajesh|LINK
Folks,
Here's a "free" to use Export To Excel control http://www.codeplex.com/ExportToExcel that I published recently.
This control, allows you to "Export" the contents of your "GridView" control to Excel {no coding required}.
Usage
Simply drag and drop the ExportToExcel button on your page and enjoy "Zero code" export feature.
Features:
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 {future release}
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) File Name: You can set the filename that you want to export.
Gridview Export to Excel
Member
77 Points
74 Posts
Re: Free:Export Gridview to Excel
Jun 13, 2008 12:28 AM|dotnetguts|LINK
This can also help you out, quickly embedding code and gets thing done.
http://dotnetguts.blogspot.com/2007/12/export-datagrid-to-excel-in-aspnet.html
http://dotnetguts.blogspot.com
Logon to
Member
86 Points
98 Posts
Re: Free:Export Gridview to Excel
Aug 28, 2008 02:32 AM|bartekm|LINK
Here's an article that describes how to export selected rows in a Gridview to Excel:
http://blog.evonet.com.au/post/2008/06/17/Gridview-that-exports-selected-rows-to-Excel.aspx
http://blog.evonet.com.au
Member
11 Points
21 Posts
Re: Free:Export Gridview to Excel
Feb 10, 2009 03:33 PM|rahul786|LINK
is there anyway of formatting the excel
like the way we can do with Microsoft.Office.Interop.Excel.ApplicationClass
Excel Formating
Contributor
3221 Points
814 Posts
Re: Free:Export Gridview to Excel
Feb 16, 2009 04:22 AM|ameenkpn|LINK
http://www.aspdotnetcodes.com/Export_GridView_To_Excel_With_Image.aspx
Contributor
2831 Points
4430 Posts
Re: Free:Export Gridview to Excel
Feb 18, 2009 04:50 PM|azamsharp|LINK
A detailed article about Export to Excel which includes common problems faced during the export task, adding styling to the exported document and disabling unwanted controls from the GridView control.
Extensive Study of GridView Export to Excel
HighOnCoding
Member
1 Points
34 Posts
Re: Export to Excel - Print Area?
Mar 08, 2009 04:21 AM|jonefer|LINK
If I add the following lines - can I affect the PrintArea and the 'Rows To Repeat" of the exported Excel?
stringWrite.Write("</body></html>") 'Added this section to test if I could make the print area different stringWrite.Write("<x:WorksheetOptions>")stringWrite.Write(
"<x:Print>") stringWrite.Write("<x:ValidPrinterInfo/>")stringWrite.Write(
"<x:Scale>73</x:Scale>") stringWrite.Write("<x:HorizontalResolution>600</x:HorizontalResolution>")stringWrite.Write(
"<x:VerticalResolution>600</x:VerticalResolution>") stringWrite.Write("</x:WorksheetOptions>")stringWrite.Write(
"</x:ExcelWorksheet>") stringWrite.Write("</x:ExcelWorksheets>")stringWrite.Write(
"<x:WindowHeight>15330</x:WindowHeight>") stringWrite.Write("<x:WindowWidth>28635</x:WindowWidth>")stringWrite.Write(
"<x:WindowTopX>0</x:WindowTopX>") stringWrite.Write("<x:WindowTopY>60</x:WindowTopY>")stringWrite.Write(
"<x:ProtectStructure>False</x:ProtectStructure>") stringWrite.Write("<x:ProtectWindows>False</x:ProtectWindows>")stringWrite.Write(
"</x:ExcelWorkbook>") stringWrite.Write("<x:ExcelName>")stringWrite.Write(
"<x:Name>Print_Titles</x:Name>") stringWrite.Write("<x:SheetIndex>1</x:SheetIndex>")stringWrite.Write(
"<x:Formula>=" & strFileName & "!$1:$1</x:Formula>") stringWrite.Write("</x:ExcelName>")HttpContext.Current.Response.Write(stringWrite.ToString())
Member
27 Points
107 Posts
Re: Export to Excel - Print Area?
Nov 12, 2010 06:37 AM|Binay Tiwari|LINK
Please Explane this this line
stringWrite.Write("<x:Formula>=" & strFileName & "!$1:$1</x:Formula>")
iam also willing to implement same thing but finding some error
BLog :Classical ASP
Member
10 Points
21 Posts
Re: Free:Export Gridview to Excel
Apr 13, 2011 04:45 AM|CikaPero|LINK
Hi,
thanks for this nice control.
Two questions: is GridView exported as HTML or as a xls\xlsx file? What excel file formats does this control supports?
So far I am using this Excel C# / VB.NET library for my Excel ASP.NET applications and it has proved quite good because it doesn't use Excel Interop, supports various excel formats (xls, xlsx, ods, csv) and has clean and nice to use API.