c# - Crystal Reports export to pdf, report doesnt apply the new parameters after first export -
i implemented loop exports crystal report pdf. idea instanciating initial report conection , inside loop applying parameters before exporting pdf (so 1 pdf each record), report keeps exporting pdf data of first loop execution. how can force refresh data after applying new parameters?
example code:
reportdocument reportdoc=new reportdocument(); reportdoc.load("c:\\reportx.rpt"); connectioninfo cinfo = functionlibrary.getcrystalconection(); foreach (table table in reportdoc.database.tables) { table.logoninfo.connectioninfo = cinfo; table.applylogoninfo(table.logoninfo); } string[] docnumbers=new[]{"1","2","3","4"}; for(int i=0;i<docnumbers.lenght; i++) { report.setparametervalue(0, docnumbers[i]); report.refresh(); diskfiledestinationoptions crdiskfiledestinationoptions = new diskfiledestinationoptions(); pdfrtfwordformatoptions crformattypeoptions = new pdfrtfwordformatoptions(); crdiskfiledestinationoptions.diskfilename = "c:\\generatedpdf " + docnumbers[i] + ".pdf"; exportoptions crexportoptions = reportdoc.exportoptions; { crexportoptions.exportdestinationtype = exportdestinationtype.diskfile; crexportoptions.exportformattype = exportformattype.portabledocformat; crexportoptions.destinationoptions = crdiskfiledestinationoptions; crexportoptions.formatoptions = crformattypeoptions; } reportdoc.export(); } reportdoc.close();
the problem @ report.refresh(); when removed line worked...
Comments
Post a Comment