从一个GridView不同的Excel工作表中导出数据不同、数据、工作、GridView

2023-09-03 08:12:00 作者:时间流窜的痛*

我是从一个数据集将数据绑定到一个网格和从网格数据导出到excel.if在网格物品的数量大于50000,则显示错误消息。

I am binding data from a dataset to a grid and exporting data from the grid to an excel.if the the number of items in the grid is greater than 50000,an error message is displayed.

所以我想将数据拆分,并在Excel工作表中的不同显示它。(我在一个Web应用程序的工作)

So i want to split the data and display it in different worksheets in excel.(Am working in a web application)

使用此$ C $下导出到Excel

using this code for exporting to excel

gvExcel.DataSource = DTS;
gvExcel.DataBind();
Response.AddHeader("content-disposition", "attachment; filename= filename.xls");
         Response.ContentType = "application/excel";
        StringWriter sw = new StringWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);
        gvExcel.RenderControl(htw);
        // Style is added dynamically
        Response.Write(style);
        Response.Write(sw.ToString());
        Response.End();

谁能帮我这个?

Can anyone help me on this??

推荐答案

以下链接这样做将是有益的。

Following links will be useful to do so..

HTTP://www.$c$cproject.com/KB/办公/ ExportDataSetToExcel.aspx

http://www.c-sharpcorner.com/blogs/ BlogDetail.aspx?BlogId = 283

希望这将帮助!