public AjaxReponseBase export(SysDictData dictData) { string rootpath = hostingEnvironment.WebRootPath + @"\ExcelFiles"; if (!Directory.Exists(rootpath)) { Directory.CreateDirectory(rootpath); } string fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + dictData.DictType + ".xlsx"; List <SysDictData> list = dictDataService.selectDictDataList(dictData); bool exportOK = ExcelUtil.ExportExcelToFile <SysDictData>(list, "参数数据", null, rootpath, fileName); if (exportOK) { return(AjaxReponseBase.Success(fileName)); } else { return(AjaxReponseBase.Error("导出失败!")); } }
public AjaxReponseBase export(SysConfig config) { List <SysConfig> list = configService.selectConfigList(config); string rootpath = hostingEnvironment.WebRootPath + @"\ExcelFiles"; if (!Directory.Exists(rootpath)) { Directory.CreateDirectory(rootpath); } string fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + config.ConfigKey + ".xlsx"; bool exportOK = ExcelUtil.ExportExcelToFile <SysConfig>(list, "参数数据", null, rootpath, fileName); if (exportOK) { return(AjaxReponseBase.Success(fileName)); } else { return(AjaxReponseBase.Error("导出失败!")); } }