码迷,mamicode.com
首页 > 其他好文 > 详细

生成word

时间:2014-11-17 17:36:09      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:style   http   io   color   ar   os   sp   on   bs   

生成Word:

    protected void Button1_Click(object sender, EventArgs e)
    {
        Export("application/ms-word", "员工报表.doc");
    }
    private void Export(string FileType, string FileName)
    {
        Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString());
        Response.ContentType = FileType;
        this.EnableViewState = false;
        StringWriter tw = new StringWriter();
        HtmlTextWriter hw = new HtmlTextWriter(tw);
        GridView1.RenderControl(hw);
        Response.Write(tw.ToString());
        Response.End();
    }

生成word

标签:style   http   io   color   ar   os   sp   on   bs   

原文地址:http://www.cnblogs.com/kaiwanlin/p/4103788.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!