public ActionResult ExcelOutput() { var repodata = repo.All(); var data = from s1 in repodata select new { s1.職稱, s1.姓名, s1.Email, s1.手機, s1.電話, s1.客戶資料.客戶名稱 }; var l_ExcelClass = new ExcelClass(); DataTable l_datatable = l_ExcelClass.ToDataTable(data); string OutputPath = l_ExcelClass.ExcelOutput(l_datatable, " ContactPerson"); return(File(Server.MapPath(OutputPath), "application/vnd.ms-excel")); }
//[HttpPost] public ActionResult ExcelOutput() { var repodata = repo.All(); var data = from s1 in repodata select new { s1.客戶名稱, s1.統一編號, s1.電話, s1.傳真, s1.地址, s1.Email }; var l_ExcelClass = new ExcelClass(); DataTable l_datatable = l_ExcelClass.ToDataTable(data); string OutputPath = l_ExcelClass.ExcelOutput(l_datatable, "Customer"); return(File(Server.MapPath(OutputPath), "application/vnd.ms-excel")); }
public ActionResult ExcelOutput() { var repodata = repo.All(); var data = from s1 in repodata select new { s1.銀行名稱, s1.銀行代碼, s1.分行代碼, s1.帳戶名稱, s1.帳戶號碼, s1.客戶資料.客戶名稱 }; var l_ExcelClass = new ExcelClass(); DataTable l_datatable = l_ExcelClass.ToDataTable(data); string OutputPath = l_ExcelClass.ExcelOutput(l_datatable, "CustomerAccount"); return(File(Server.MapPath(OutputPath), "application/vnd.ms-excel")); }