如何将Repeater控件中的数据导出到excel
1个回答
展开全部
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw);
this.reptStaff.RenderControl(hw);
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
Page.EnableViewState = false;
Response.AppendHeader("Content-Disposition", "attachment;filename=Teacher.xls");
Response.Write("<html><head><meta http-equiv=Content-Type content=\"text/html; charset=utf-8\"><title> Copyright by SDU</title>埋橡</head><body><center>");
Response.Write(sw.ToString());
Response.Write("</center></弯型旁body></html>"租祥);
Response.End();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw);
this.reptStaff.RenderControl(hw);
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
Page.EnableViewState = false;
Response.AppendHeader("Content-Disposition", "attachment;filename=Teacher.xls");
Response.Write("<html><head><meta http-equiv=Content-Type content=\"text/html; charset=utf-8\"><title> Copyright by SDU</title>埋橡</head><body><center>");
Response.Write(sw.ToString());
Response.Write("</center></弯型旁body></html>"租祥);
Response.End();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询