我正在使用Asp.net应用程序。对于报告,我们使用GridView导出到Excel。在IE浏览器上也是如此。从Chrome浏览器中完成同样的操作.aspx Page已下载。
以下是导出代码
Dim Excelfilename As String = "OnlinePaymentTranRpt" +
Format(DateTime.Now, "ddMMyyyyhhmm")
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("Content-Disposition:", "attachment; filename="
+ Excelfilename + ".xls")
Response.Charset = ""
'Me.EnableViewState = False
Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter()
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)
GridView1.RenderControl(oHtmlTextWriter)
Response.Write(oStringWriter.ToString())
Response.End()