文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>从gridview中导入excel

从gridview中导入excel

时间:2010-11-04  来源:凌鸢

public void outExcel()
        {
            string name = returnName();

            string style = @"<style>.text{mso-number-format:\@;}</style>";

            Response.ClearContent();

            Response.Buffer = true;
            Response.Charset = "gb2312";
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");

            Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(name, System.Text.Encoding.UTF8) + ".xls");

            Response.ContentType = "application/excel";

            StringWriter sw = new StringWriter();

            HtmlTextWriter htw = new HtmlTextWriter(sw);

            GridView1.RenderControl(htw);

            Response.Write(style);

            Response.Write(sw.ToString());

            Response.End();
        }
相关阅读 更多 +
排行榜 更多 +
实时多人坦克

实时多人坦克

飞行射击 下载
特殊变种人学院

特殊变种人学院

体育竞技 下载
狂野破坏王

狂野破坏王

体育竞技 下载