标签:style color os io 数据 for ar 代码
protected void btndaochu_Click(object sender, EventArgs e)
{
GetList();//读取GridView 数据 这里就不写了
Response.Clear();
Response.Charset = "utf-8";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.Buffer = true;
Response.AppendHeader("Content-Disposition", "attachment;filename=中标数据集合.xls");
Response.ContentType = "application/ms-excel";
this.EnableViewState = false;
System.IO.StringWriter tw = new System.IO.StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
this.GridViewMain.RenderControl(hw);
Response.Output.Write(tw.ToString());
Response.Flush();
Response.End();
}
public override void VerifyRenderingInServerForm(Control control)
{
//无须填写任何代码
}
GridView 导出Excel,布布扣,bubuko.com
标签:style color os io 数据 for ar 代码
原文地址:http://www.cnblogs.com/sl372/p/3921566.html