如何将文本或图像添加到我从datagrid读取的Excel中

时间:2013-10-01 09:03:42

标签: vb.net excel

我使用下面的代码工作正常,我只想在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()

0 个答案:

没有答案