我目前正在尝试通过我的网页打开Excel文档,但我一直收到此错误:
"您尝试打开的文件" PaymentApplication.xls"在... 不同于扩展名"
指定的格式
excel表工作正常,但我无法弄清楚如何摆脱错误。 我尝试了很多东西试图摆脱它,我似乎无法摆脱它
这是我的代码:
Protected Sub excelBtn_Click(sender As Object, e As System.EventArgs) Handles excelBtn.Click
Dim sw, sw0 As New StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(sw)
Dim hw0 As New System.Web.UI.HtmlTextWriter(sw0)
Dim frm As HtmlForm = New HtmlForm()
Dim frm1 As HtmlForm = New HtmlForm()
Response.AddHeader("content-disposition", "attachment;Filename=PaymentApplication.xls")
Response.ContentType = "application/vnd.ms-excel"
Response.Charset = ""
EnableViewState = False
frm.Attributes("runat") = "server"
Controls.Add(frm)
frm.Controls.Add(AppPayments)
'InscapeLogo.RenderControl(hw)
frm.Controls.Add(GridView1)
frm.RenderControl(hw)
Response.Write(sw.ToString())
Response.Flush()
Response.End()
End Sub
如果我能得到一些帮助,我将非常感谢,谢谢你提前