zoukankan      html  css  js  c++  java
  • AspNet GridView Excel 下载 Excel 导出

    1.GridView

    • AutoGenerateColums =false;
    • DataSource
    • DataBind

    2.BoundField

    • DataField
    • HeaderText
    • ItemStyle.HorizontalAlign
    • Visible

    3.StringWriter sw =new StringWriter ();

    4.HtmlTextWriter htw =new HtmlTextWriter(sw);

    5.Gridview.RenderConterol(htw)

    6.Response

    • Response.ClearContent();
    • Response.AddHeader("content-disposition", "attachment; filename=name.xls");
    • Response.ContentType = "application/unknown";
    • Response.Write("<meta http-equiv='Content-Type' content='text/html; charset=" + Request.ContentEncoding.HeaderName+ "'>");
    • Response.Write(sw.ToString());
    • Response.End();
  • 相关阅读:
    使用Python往手机发送短信(基于twilio模块)
    春&风
    故乡
    非常完美
    风 记忆
    风誓
    MATLAB的循环结构
    你要的快乐
    夕颜
    MATLAB的基本元素
  • 原文地址:https://www.cnblogs.com/ok519/p/6840396.html
Copyright © 2011-2022 走看看