English 中文(简体)
出口数据,从电离层到不同外壳体。
原标题:Exporting data from a gridview to different excel worksheets

我从数据集到电网,把数据从电网出口到外壳。 如果电网中的物品数量超过500 000件,就会显示错误信息。

因此,我想将数据分开,并用外壳的不同工作表格显示数据。 (在网络应用中工作)

利用该法典出口至外壳

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();

谁能帮助我?

问题回答

确实,你需要实际使用Excel AP并创建文件,而不仅仅是超文本版本。 利用HtmlTextWriter是一种极具灾难的,我对下载使用它的文件表示仇恨,因为它总是一片肉。 我必须再次把它作为轴心(因为其真的只是超文本),并着手加以固定。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签