.net直接导出Excel

workbook = new HSSFWorkbook();

HttpResponse response = System.Web.HttpContext.Current.Response;

response.Clear();

response.Charset = "UTF-8";

response.ContentType = "application/vnd.ms-excel";//"application/pdf";

response.AddHeader("Content-Disposition", string.Format("attachment; filename=" + Utils.UrlEncode(fileName)));

workbook.Write(response.OutputStream);

response.End();

猜你喜欢

转载自blog.csdn.net/oYuHuaChen/article/details/94736505