0

我正在使用以下工作正常的代码,我只想在 DataGrid 数据之前将自定义文本或图像添加到 Excel 工作表中。

Response.Clear()

Response.AddHeader("content-disposition", "attachment;filename=TabelDetails.xls")

Response.Charset = ""

Response.Cache.SetCacheability(HttpCacheability.NoCache)

Response.ContentType = "application/vnd.xls"

Dim stringWrite As StringWriter = New StringWriter()

Dim htmlWrite As HtmlTextWriter = New HtmlTextWriter(stringWrite)

Me.datagrid.RenderControl(htmlWrite)

Response.Write(stringWrite.ToString())

Response.End()
4

0 回答 0