/// <summary> /// List<T>转化为Excel文件,并返回FileStreamResult /// </summary> /// <param name="list">需要转化的List<T></param> /// <param name="headerList">Excel标题行的List列表</param> /// <param name="fileName">Excel的文件名</param> /// <returns></returns> public static FileStreamResult ExportListToExcel_MVCResult <T>(IList <T> list, IList <string> headerList, string fileName) { var fsr = new FileStreamResult(ExcelTool.ExportListToExcel(list, headerList, null), "application/ms-excel") { FileDownloadName = HttpUtility.UrlEncode(fileName + ".xls") }; return(fsr); }