public FileResult ExportSample(E_PageParameter ePageParameter) { List <tb_Sample> list = _dSample.GetSampleList(ePageParameter); string filename = "样品列表" + DateTime.Now.ToFileTime() + ".xls"; string path = Server.MapPath("/upfile/sample/" + filename); NPOITools.RenderToExcel <tb_Sample>(list, path); return(File(path, "application/vnd.ms-excel", filename)); }
public FileResult ExportSamplingSheet(E_PageParameter ePageParameter) { List <E_SamplingSheet> list = _dSample.GetSamplingSheetList(ePageParameter); string filename = "分样单" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".doc"; string filetemplatepath = Server.MapPath("/upfile/template/分样单模板.docx"); string path = Server.MapPath("/upfile/samplingsheet/" + filename); NPOITools.RenderToWord <E_SamplingSheet>(list, filetemplatepath, path); return(File(path, "application/vnd.ms-word", filename)); }
public ActionResult Export(GroupListViewModel m) { //分頁物件,設定單頁筆數為最大值 Pages pages = new Pages(); pages.PageSize = int.MaxValue; //取回資料 var dt = GroupDataAccess.GetGroupList(null, m.Parameters.GroupName, pages); //轉為二進位資料流 var numList = new List <int>(); MemoryStream ms = NPOITools.RenderDataTableToExcel(dt, numList) as MemoryStream; return(File(ms.ToArray(), "application/vnd.ms-excel")); }
public ActionResult Export(SysParamsListViewModel m) { //分頁物件,設定單頁筆數為最大值 Pages pages = new Pages(); pages.PageSize = int.MaxValue; //清單資料 DataTable dtList = SysParamsDataAccess.GetSysParams(m.Parameters.ParaCode, m.Parameters.ParaDesc, m.Pages); //轉為二進位資料流 var numList = new List <int>(); MemoryStream ms = NPOITools.RenderDataTableToExcel(dtList, numList) as MemoryStream; return(File(ms.ToArray(), "application/vnd.ms-excel")); }
public ActionResult Export(UserListViewModel m) { //分頁物件,設定單頁筆數為最大值 Pages pages = new Pages(); pages.PageSize = int.MaxValue; //取回資料 DataTable dt = UserDataAccess.GetUserList(null, m.Parameters.Account, null, m.Parameters.Email, m.Parameters.Name, pages); //處理資料 dt.Columns.Remove("Password"); //轉為二進位資料流 var numList = new List <int>(); MemoryStream ms = NPOITools.RenderDataTableToExcel(dt, numList) as MemoryStream; return(File(ms.ToArray(), "application/vnd.ms-excel")); }