将excel文件从GridView保存到本地计算机ASP.NET VB
问题描述:
嗨
我想将Excel文件保存到特定路径,但是在客户端计算机中,而不是在服务器中。有可能吗?
Hi
I want to save Excel file to specific path, but in client computer, not in server. It is possible?
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()
答
尝试这个论坛,这可能帮助你,export-excel-data-to-datagrid-using-openfiledialog / [ ^ ]
或者这个。 [ ^ ]
我认为你应该指定一个路径文件,以便它保存在客户端电脑上。
TRY THIS FORUM , THIS MIGHT HELP YOU, export-excel-data-to-datagrid-using-openfiledialog/[^]
OR THIS. [^]
And i think you should specify a pathfile so that it saves on client pc.