本文介绍了一页中的两个网格视图。如何使用两个选项卡将点击按钮上的两个网格视图导出到一个Excel工作表,每个网格视图一个选项卡!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有两个Gridview。 GridView1和GridView2在一个页面上。但是,我想将两个gridviews导出到一个选项卡上的Gridview1和另一个选项卡上的GridView2上。这可能与我在下面实现的代码有关吗? 是否可以为GridView2的excel添加另一个选项卡? I have two Gridviews. GridView1 and GridView2 on one page. However, i want to export both gridviews into an excel having Gridview1 on one tab and GridView2 on another tab. Is that possible with the code that i have implemented below? Is it possible to add another tab to the excel for GridView2? Protected Sub ExportAsExcel_Click(sender As Object, e As EventArgs) Handles ExportAsExcel.ClickResponse.Clear() Response.Buffer = True Response.AddHeader("content-disposition", "attachment;filename=Export.xls") Response.Charset = "" Response.ContentType = "application/vnd.ms-excel" Using sw As New StringWriter() Dim hw As New HtmlTextWriter(sw) GridView1.RenderControl(hw) Dim style As String = "" Response.Write(style) Response.Output.Write(sw.ToString()) Response.Flush() Response.End() End Using End Sub 我的尝试: 谷歌没有帮助。我甚至试图将GridView 2添加到代码中,但我在逻辑上陷入了这个问题。What I have tried:Google was no help. I even tried to add GridView 2 to the code but i am logically stuck in this matter.推荐答案 这篇关于一页中的两个网格视图。如何使用两个选项卡将点击按钮上的两个网格视图导出到一个Excel工作表,每个网格视图一个选项卡!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
11-02 02:24