Bill Humphrey
Active member
- Joined
- Apr 10, 2008
- Messages
- 35
- Programming Experience
- Beginner
Hi
How can I export data from in a data grid to XL or word. I found this code but it just opens a blank XL sheet:
Response.Clear()
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls")
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = "application/vnd.xls"
Dim stringWrite As new System.IO.StringWriter()
Dim htmlWrite As new HtmlTextWriter(stringWrite)
myDataGrid.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Response.End();
Regards Bill
How can I export data from in a data grid to XL or word. I found this code but it just opens a blank XL sheet:
Response.Clear()
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls")
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = "application/vnd.xls"
Dim stringWrite As new System.IO.StringWriter()
Dim htmlWrite As new HtmlTextWriter(stringWrite)
myDataGrid.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Response.End();
Regards Bill