| | |
| | | using NPOI.HSSF.UserModel; |
| | | using Microsoft.AspNetCore.Hosting; |
| | | using NPOI.HSSF.UserModel; |
| | | using NPOI.SS.UserModel; |
| | | using NPOI.SS.Util; |
| | | using NPOI.XSSF.UserModel; |
| | |
| | | { |
| | | var filename = filenName + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; |
| | | string fileip = AppSetting.GetAppSetting("FileIP"); |
| | | var filepath = CoreHttpContext.MapPath("/File/newxls/"); |
| | | var filepath = CoreHttpContext.MapPath("/newxls/"); |
| | | var path = filepath + filename; |
| | | |
| | | if (!Directory.Exists(filepath)) |
| | |
| | | var b = DALSkillCondition.ResultExcel(path, dt); |
| | | if (b) |
| | | { |
| | | var url = fileip + "/apis/File/newxls/" + filename; |
| | | var url = fileip + "/apis/newxls/" + filename; |
| | | return url; |
| | | } |
| | | var messge = filename + "下载失败"; |
| | |
| | | { |
| | | string fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xlsx"; |
| | | string fileip = AppSetting.GetAppSetting("FileIP"); |
| | | string filePath = CoreHttpContext.MapPath("/File/newxls/"); |
| | | string filePath = CoreHttpContext.MapPath("/newxls/"); |
| | | |
| | | Directory.CreateDirectory(filePath); |
| | | string Path = filePath + fileName; |
| | |
| | | using (fs = File.OpenWrite(Path)) |
| | | { |
| | | workbook.Write(fs); |
| | | var url = fileip + "/File/newxls/" + fileName; |
| | | var url = fileip + "/newxls/" + fileName; |
| | | return url; |
| | | } |
| | | } |
| | |
| | | { |
| | | string fileName = filenName + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xlsx"; |
| | | string fileip = AppSetting.GetAppSetting("FileIP"); |
| | | string filePath = CoreHttpContext.MapPath("/File/newxls/"); |
| | | string filePath = CoreHttpContext.MapPath("wwwroot/newxls/"); |
| | | Directory.CreateDirectory(filePath); |
| | | string Path = filePath + fileName; |
| | | |
| | |
| | | headerRow.CreateCell(j).SetCellValue(ds.Columns[j].ColumnName); |
| | | headerRow.GetCell(j).CellStyle = headStyle; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | rowIndex = 1; |
| | | } |
| | | |
| | |
| | | |
| | | rowIndex++; |
| | | } |
| | | |
| | | |
| | | using (fs = File.OpenWrite(Path)) |
| | | { |
| | | workbook.Write(fs); |
| | | var url = fileip + "/File/newxls/" + fileName; |
| | | var url = fileip + "/newxls/" + fileName; |
| | | return url; |
| | | } |
| | | } |