/// <summary> /// 返回考试分析图 /// </summary> /// <returns></returns> public FileResult ExamChart() { string sKey="考试报表Models"; Chart chart = null; try { /* 返回存在Session中的考试报表Models */ ExamReportModels examReportModels = (ExamReportModels)Session[sKey]; LKExamChart lKChart = new LKExamChart(); chart = lKChart.Get考试分析图形(examReportModels); return lKChart.Get考试分析FileResult(chart); } catch (Exception) { return null; } finally { chart.Dispose(); chart = null; Session[sKey] = null; Session.Clear(); } }
/// <summary> /// 导出考试报表到Word,将ExamReportModels的考试报表导出到Word文件 /// </summary> /// <param name="examReportModels">考试报表Models</param> /// <param name="sFileName">文件名称,考试名称</param> public void 导出考试报表到Word(ExamReportModels examReportModels, string sFileName) { LKExamChart lKChart = new LKExamChart(); lKChart.Save考试分析Chart(examReportModels); HttpRequest httpRequest = HttpContext.Current.Request; string s内容 = ""; s内容 += "<link href=\"" + httpRequest.Url.Scheme + "://" + httpRequest.Url.Authority + "/Content/StyleSheet/Global.css\" rel=\"stylesheet\" type=\"text/css\" />"; s内容 += @"<style> table{width:600px;} tr{height:25px;} td{text-align: center;border: #abc0db 1px solid;} h1{font-size:20px;} h3{font-size:14px;} h1,div.detailsInfo{text-align: center;} div.manage{margin-top:30px;} </style>"; s内容 += AnalysisExtensions.ExamReport标题(examReportModels.考试设置); s内容 += AnalysisExtensions.ExamReport图形WORD版(examReportModels); s内容 += AnalysisExtensions.ExamReport表格(examReportModels.考试分析); s内容 += AnalysisExtensions.ExamReport情况(examReportModels.DataTable); s内容 += AnalysisExtensions.ExamReport管理(examReportModels.考试分析); //导出Word 导出BODY到WORD(s内容, sFileName); }