Repeater导出到Excel~ 急求帮助!
各位大侠, 我现在要做一个将Repeater的内容导出到Excel的功能。要求是选择了时间后,导出这个时间段内有数据的内容。结果如图。

急求帮助,顶者有分~~ 帮顶。之前只整过GridView导出的,但是样式貌似导出到Excel后,无法保持。标记!!!学习...
[解决办法]
Response.Clear();
Response.Buffer = true;
Response.Charset = "utf-8";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("名称", System.Text.Encoding.UTF8) + ".xls");
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); //设置输出流为简体中文
Response.ContentType = "application/ms-excel"; //设置输出文件类型为excel文件。
this.EnableViewState = false;
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN", true);
System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad);
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
// repeater控件的ID
repeater.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
[解决办法]
[解决办法]
http://www.cnblogs.com/xiaotao823/archive/2008/09/26/1299364.html
http://www.cnblogs.com/stswordman/archive/2006/08/24/485641.html
[解决办法]
你这个导出还需要合并单元格
建议做成水晶报表 用水晶报表自带的导出excel功能
[解决办法]
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw);
this.Repeater1.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=GB2312/"><title> Copyright by SDU</title></head><body><center>");
Response.Write(sw.ToString());
Response.Write("</center></body></html>");
Response.End();
就是先筛选数据出来 然后通过EXCEL模板导出
如果需要做报表
内功心法