首页 新闻 会员 周边 捐助

将Repeater数据导出致EXCEL

0
悬赏园豆:5 [已关闭问题] 关闭于 2013-05-31 09:32

我想将所有的数据都导出致excel,repeater上是什么样的格式,导出来就是什么格式,repeater上是什么字体就是什么字体

怎么破??

NothingHave的主页 NothingHave | 初学一级 | 园豆:6
提问于:2013-05-23 09:40
< >
分享
所有回答(1)
0
public override void VerifyRenderingInServerForm(Control control) { }
    protected void Unnamed1_Click(object sender, EventArgs e)
    {
        string FileName = "用稿统计表";
        Response.Clear();
        Response.Buffer = true;
        Response.Charset = "utf-8";
        Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName) + ".xls");
        Response.ContentEncoding = System.Text.Encoding.UTF8;
        Response.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。 
        System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
        pannel.RenderControl(oHtmlTextWriter); //pannel为其容器ID
        Response.Output.Write(oStringWriter.ToString());
        Response.Flush();
        Response.End();
    }
yyutudou | 园豆:997 (小虾三级) | 2013-05-23 11:08
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册