Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can use the following article to create it <a href="http://dotnetask.com/Resource.aspx?Resourceid=644" rel="nofollow">http://dotnetask.com/Resource.aspx?Resourceid=644</a> . Even I know SpreadSheetgear company provides DLL to do so . Try to find more in codeplex , I think their also you can find couple of options. Check out this : <a href="http://npoi.codeplex.com/" rel="nofollow">http://npoi.codeplex.com/</a> and <a href="http://closedxml.codeplex.com/" rel="nofollow">http://closedxml.codeplex.com/</a>. Remember at the end of the day GridView is nothing than the collection of data so you can give the option to end use to download in excel in case you have so many pages of data</p> <pre><code> ExportToExcel excel = new ExportToExcel(); context.Response.Clear(); context.Response.AddHeader("content-disposition", String.Format("attachment; filename={0}", fileName + ".xls")); context.Response.ContentType = "application/ms-excel"; context.Response.Write(excel.Excel(YOURCollection)); context.Response.End(); public class ExportToExcel { public StringWriter Excel(MyCollection) { using (StringWriter sw = new StringWriter()) { using (HtmlTextWriter htw = new HtmlTextWriter(sw)) { Table table = new Table(); TableRow tableRow = new TableRow(); TableHeaderCell header; header = new TableHeaderCell(); header.Text = "Receipt Id"; header.BorderStyle = BorderStyle.Solid; tableRow.Cells.Add(header); foreach (MyItem) { TableRow row = new TableRow(); TableCell cell; cell = new TableCell(); cell.Text = "" + MyItem.Info; cell.BorderStyle = BorderStyle.Solid; row.Cells.Add(cell); table.Rows.Add(row); } table.RenderControl(htw); return sw; } } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload