aspx导出excel
string TBhtml = h_derive_tbList.Value; Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"); Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
//解决IE导出标题乱码
Response.AddHeader("content-disposition", "attachment; filename=" + HttpUtility.UrlEncode("大型设备库存记录", System.Text.Encoding.UTF8) + ".xls");
Response.ContentType = "application/excel"; Response.Write(TBhtml); Response.End();
//解决导出表格内容乱码,该代码加到表格前
///<meta http-equiv=\"content-type\" content=\"application/ms-excel; charset=UTF-8\"/>