protected void btnExportToExcel_Click(object sender, EventArgs e)
{
this.gvList.AllowPaging = false;
BindGrid();
string style = @"<style> .formatText { mso-number-format:/@; }</style> ";
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment; filename=/"" + System.DateTime.Now.ToString("yyyy-MM-dd") + System.Web.HttpUtility.UrlEncode("一览表", System.Text.Encoding.UTF8) + ".xls/"");
Response.ContentType = "application/excel";
Response.Charset = "GB2312";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
gvList.RenderControl(htw);
Response.Write(style);
Response.Write(sw.ToString());
Response.End();
}