Home/ASP.NET Forums/Community/Tips & Tricks/Free:Export Gridview to Excel

Free:Export Gridview to Excel RSS

8 replies

Last post Apr 13, 2011 04:45 AM by CikaPero

DotNetGuts (DNG)
http://dotnetguts.blogspot.com
Logon to
  • bartekm

    bartekm

    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

    ASP.NET Development Blog:
    http://blog.evonet.com.au
  • rahul786

    rahul786

    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

  • ameenkpn

    ameenkpn

    Contributor

    3221 Points

    811 Posts

    Re: Free:Export Gridview to Excel

    Feb 16, 2009 04:22 AM|ameenkpn|LINK

    This article export GridView to Excel with Images

    http://www.aspdotnetcodes.com/Export_GridView_To_Excel_With_Image.aspx
    Marking a Reply as 'Answered', not only GAIN us some POINTS, but it also HELP others to find RIGHT solution.
  • azamsharp

    azamsharp

    Contributor

    2831 Points

    4524 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

    ASP.NET articles and videos
    HighOnCoding
  • jonefer

    jonefer

    Member

    1 Points

    35 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())

  • Binay Tiwari

    Binay Tiwari

    Member

    27 Points

    108 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

    Please mark as Answered if it helps.
    BLog :Classical ASP
  • CikaPero

    CikaPero

    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.

  • ‹ Previous Thread|Next Thread ›