有没有办法将 gridview 导出到 MS word 并保留 gridview 的格式。下面的代码可以导出gridview,但我不知道如何保持格式。(我不能使用任何第三方软件)
Response.Clear()
Response.Buffer = True
Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.doc")
Response.Charset = ""
Response.ContentType = "application/vnd.ms-word"
Dim sw As New StringWriter()
Dim hw As New HtmlTextWriter(sw)
GridView1.RenderControl(hw)
Response.Output.Write(sw.ToString())
Response.Flush()
Response.End()