/// <summary> /// 导出 /// </summary> /// <returns></returns> public ActionResult Chu() { try { string PathName = Server.MapPath("/save/"); string textPath = Path.Combine(PathName + "1.xls"); List <Member> m = bl.Show(); Dictionary <string, string> str = new Dictionary <string, string>(); str.Add("Id", "编号"); str.Add("Name", "姓名"); str.Add("Sex", "性别"); str.Add("Deadline", "使用期限"); str.Add("Create", "创建日期"); NPOIExcelHelper <Member> .ExportExcel(m, str, textPath); return(Content("<script>alert('导出成功');location.href='/Member/Index'</script>")); } catch { return(Content("<script>alert('导出失败');location.href='/Member/Index'</script>")); } }