Response.Clear() Response.Buffer = True Response.AddHeader("content-disposition", "attachment; filename=test.xls") Response.ContentEncoding = System.Text.Encoding.default Response.Charset = "" Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" dim sWriter As New StringWriter() Dim hWriter As New HtmlTextWriter(sWriter) GridView1.AllowPaging = False GridView1.RenderControl(hWriter) Response.Output.Write(sWriter.ToString()) Response.Flush() Response.End()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)