Asked by:
Free:Export Gridview to Excel

Question
-
User-766375372 posted
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.
Sunday, October 7, 2007 11:15 AM
All replies
-
User946268604 posted
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
- Import Excel To Datagrid ASP.net
- Export Datagrid Data To Excel
Friday, June 13, 2008 12:28 AM -
User-2109426844 posted
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
Thursday, August 28, 2008 2:32 AM -
User-1303627691 posted
is there anyway of formatting the excel
like the way we can do with Microsoft.Office.Interop.Excel.ApplicationClass
Tuesday, February 10, 2009 3:33 PM -
User1372467857 posted
This article export GridView to Excel with Images
http://www.aspdotnetcodes.com/Export_GridView_To_Excel_With_Image.aspxMonday, February 16, 2009 4:22 AM -
User43093768 posted
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.
Wednesday, February 18, 2009 4:50 PM -
User-768222909 posted
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())
Sunday, March 8, 2009 4:21 AM -
User1669332222 posted
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
Friday, November 12, 2010 6:37 AM -
User793200426 posted
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.
Wednesday, April 13, 2011 4:45 AM