I use CR to export PDF file according to parameters I send from my ASP.NET Web Forms application. In the current situation, I can export one page PDF but I want to add more pages with different info.
Current situation: When I export PDF from my ASP.NET app
What I try to achieve: Different Pages with different information but same format
In summary, I am trying to add pages in the for loop, is that possible to add different pages in the same format?
My CR report: CR report
My code in ASP.NET Web Forms application: (dt datatable in the code is actually have more rows but I couldn't find how to show each record in seperate page in the example above)
ReportDocument reportDocument = new ReportDocument();
reportDocument.Load(Server.MapPath(@"Report\MyReportFile.rpt"));
DataTable dt = new DataTable();
dt = new DummyDL().PROCEDURE_GET_DUMMY_DATA(DUMMY_NO);
reportDocument.SetParameterValue("P_DUMMY", DUMMY);
reportDocument.SetParameterValue("P_DUMMY1", Convert.ToString(dt.Rows[0]["DUMMY1"]));
reportDocument.SetParameterValue("P_DUMMY2", Convert.ToString(dt.Rows[0]["DUMMY2"]));
reportDocument.SetParameterValue("P_DUMMY3", Convert.ToString(dt.Rows[0]["DUMMY3"]));
PrintOptions printOptions = reportDocument.PrintOptions;
ExportOptions exportOpts = new ExportOptions();
PdfFormatOptions pdfOpts = ExportOptions.CreatePdfFormatOptions();
exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat;
exportOpts.ExportFormatOptions = pdfOpts;
reportDocument.ExportToHttpResponse(exportOpts, Response,false, "");
if (!IsPostBack) CrystalReportViewer1.Error += new ErrorEventHandler(CrystalReportViewer1_Error);
CrystalReportViewer1.ReportSource = reportDocument;
CrystalReportViewer1.DataBind();
Simply add the data for the other pages to the data source.
For example, if you are limiting the data to one order by passing a parameter of OrderID and applying a record selection based on that parameter, change the parameter to allow multiple values.