如何将多个asp面板导出为ex​​cel [英] how to export multiple asp panels to excel

查看:51
本文介绍了如何将多个asp面板导出为ex​​cel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何将多个面板导出为ex​​cel。我得到了这段代码:

I want to know how to export multiple panels to excel. I got this code:

Response.Clear()
Response.AddHeader("content-disposition", "attachment;filename= Report.xls")
Response.Charset = ""
Response.ContentType = "application/vnd.ms-excel"
Dim stringWrite As New System.IO.StringWriter()
Dim htmlWrite As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(stringWrite)
Panel4.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Response.End()



它仅适用于1个面板。如果我添加另一个面板并添加代码仍然无法正常工作。有没有办法做到这一点?



这是我的2个面板的代码:


It only works for 1 panel only. If I add another panel and add in the code still doesn't work. is there any way to do this?

This is my code for 2 panels:

Response.Clear()
Response.AddHeader("content-disposition", "attachment;filename= Report.xls")
Response.Charset = ""
Response.ContentType = "application/vnd.ms-excel"
Dim stringWrite As New System.IO.StringWriter()
Dim htmlWrite As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(stringWrite)
Dim stringWrite2 As New System.IO.StringWriter()
Dim htmlWrite2 As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(stringWrite2)
Panel4.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Panel2.RenderControl(htmlWrite2)
Response.Write(stringWrite2.ToString())
Response.End()

推荐答案

参考



C#如何读取包含3行代码的.xlsx Excel文件 [ ^ ]



使用VB.Net导出到Excel - CodeProject [ ^ ]


这篇关于如何将多个asp面板导出为ex​​cel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆