protected ActionResult ExportExcelCommon <T>(List <T> items, Dictionary <string, string> headers, bool isshowheader, string teamplate, int rowstart, int colstart, string filename, List <ItemExcel> itemexcels) { teamplate = HttpContext.Server.MapPath(Path.Combine("~/Templates/", teamplate)); var ftmp = DateTime.Now.ToString("ddMMyyyssmmhh"); var down = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Downloads", ftmp, filename); XLWorkbook MyWorkBook = new XLWorkbook(); CUtils.ExportExcel <T>(out MyWorkBook, items, headers, isshowheader, teamplate, rowstart, colstart, itemexcels); Directory.CreateDirectory(Path.GetDirectoryName(down)); MyWorkBook.SaveAs(down); return(File(down, ".xlsx", filename)); }