diff --git a/ZR.Admin.WebApi/Controllers/BaseController.cs b/ZR.Admin.WebApi/Controllers/BaseController.cs index 2f49601..fe5f613 100644 --- a/ZR.Admin.WebApi/Controllers/BaseController.cs +++ b/ZR.Admin.WebApi/Controllers/BaseController.cs @@ -145,6 +145,24 @@ namespace ZR.Admin.WebApi.Controllers return (sFileName, fullPath); } + /// + /// 导出多个工作表(Sheet) + /// + /// + /// + /// + protected (string, string) ExportExcelMini(Dictionary sheets, string fileName) + { + IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment)); + string sFileName = $"{fileName}{DateTime.Now:MM-dd-HHmmss}.xlsx"; + string fullPath = Path.Combine(webHostEnvironment.WebRootPath, "export", sFileName); + + Directory.CreateDirectory(Path.GetDirectoryName(fullPath)); + + MiniExcel.SaveAs(fullPath, sheets); + return (sFileName, fullPath); + } + /// /// 下载导入模板 ///