将Repeater里的数据导出Excel 并计算某列的和。。该怎么实现呀!
数据已经导出了,可是还需要实现统计功能,比如统计 E F G的和。该怎么实现呀。
导出代码在下面
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.Charset = "UTF-8";
//
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + DateTime.Now.ToString("yyyy-mm-dd") + ".xls");
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");
HttpContext.Current.Response.ContentType = "application/ms-excel";
//
CultureInfo cultureInfo = new CultureInfo("ZH-CN", true);
StringWriter stringWriter = new StringWriter(cultureInfo);
HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
this.Repeater1.RenderControl(htmlTextWriter);
HttpContext.Current.Response.Write(stringWriter.ToString());
HttpContext.Current.Response.End();
C#,.net
--------------------编程问答--------------------
在导出前就应该统计好!然后导入进去!
--------------------编程问答--------------------