问题描述
嗨 我有一个htm报告,我想在页面加载事件中将其转换为pdf如何可能 谢谢
Hi I have one htm report and i want to convert it to pdf in page load event how to it possible Thanks
推荐答案
使用CrystalDecisions.CrystalReports.Engine; 使用CrystalDecisions.Shared; 使用CrystalDecisions.Shared.Interop; 使用System.IO; bool status = false; DataTable dt = new DataTable( ); 学生stu =新学生(); dt = stu.getActiveBlockStudentReport(0,Convert.ToString(ddlDepartment.SelectedValue),Convert.ToString(ddlCourses.SelectedValue) ),Convert.ToString(ddlStatus.SelectedValue)); 尝试 { if(dt!= null && dt.Rows.Count> ; 0) { if(File.Exists(Server.MapPath(〜/ ActiveBlockStudent.Pdf))) { System.IO.File.Delete(Server.Ma pPath(ActiveBlockStudent.Pdf)); } string rptName = Server.MapPath(〜\\Reports \\ \\\rptBlockActiveStudent.rpt); ReportDocument RptDoc = new ReportDocument(); RptDoc.Load(rptName); RptDoc。 SetDataSource(dt); ExportOptions exportOpts1 = RptDoc.ExportOptions;