rinoel

rinoel

  • NA
  • 43
  • 0

Export from Asp.Net to Excel

Oct 13 2004 6:47 AM
I've seen this code: http://www.c-sharpcorner.com/Code/2003/Sept/ExportASPNetDataGridToExcel.asp private void Button1_Click(object sender, System.EventArgs e) { //export to excel Response.Clear(); Response.Buffer= true; Response.ContentType = "application/vnd.ms-excel"; Response.Charset = ""; this.EnableViewState = false; System.IO.StringWriter oStringWriter = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter); this.ClearControls(dg); dg.RenderControl(oHtmlTextWriter); Response.Write(oStringWriter.ToString()); Response.End(); } Can I set shhet name ???? For default, the name of sheet is the same of the page. Thank you.

Answers (2)