作者:乔山办公网日期:
返回目录:excel表格制作
这样来~自zhidao
Response.Clear();
Response.AddHeader("content-disposition", "online;filename=test.xls");
Response.ContentType = "appilication/vnd.ms-excel";
Response.Charset = "";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
GridView dg = new GridView();
dg.DataSource = ds;
dg.DataBind();
dg.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();