我正在使用以下代码处理crystal report export pdf,但是当导出为pdf时,错误将出现在第9行。
错误:找不到方法:'CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag CrystalDecisions.ReportAppServer.ReportDefModel.ISCRExportOptions.get_ExportOptionsEx()'。
ReportDocument crystalReport = new ReportDocument();
crystalReport.Load(Server.MapPath("FrontRor_S.rpt"));
DataSet ds = GetData();
DataTable dt = new DataTable();
dt = ds.Tables[0];
crystalReport.SetDataSource(dt);
CrystalReportViewer1.ReportSource = crystalReport;
ExportFormatType formatType = ExportFormatType.PortableDocFormat;
crystalReport.ExportToHttpResponse(formatType, Response, true, "Crystal");
Response.End();
答案 0 :(得分:0)
ExportOptions CrExportOptions ;
DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();
CrDiskFileDestinationOptions.DiskFileName = "C:\\SampleReport.pdf";
CrExportOptions = doc.ExportOptions;
{
CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
CrExportOptions.FormatOptions = CrFormatTypeOptions;
}
doc.Export();
请在crystalReport.SetDataSource(dt);
之后试用此代码
这肯定会奏效。