cancel
Showing results for 
Search instead for 
Did you mean: 

Export report as RTF file with parameters

Former Member
0 Kudos

Post Author: OlivierM

CA Forum: JAVA

Hi,

I want to export a report as a RTF file and specify parameters with the Java Report Component with Crystal report 10. The RTF report is generated but the parameter is not modified. I have a report with only 1 parameter named firstname."bobby" is not visible in the RTF file. There is only an empty String. Thanks for your help to solve my problem... The java code source: IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();reportSource = (IReportSource) rptSrcFactory.createReportSource(report, request.getLocale());Fields fields = new Fields();ParameterField pfield1 = new ParameterField();Values vals1 = new Values();ParameterFieldDiscreteValue pfieldDV1 = new ParameterFieldDiscreteValue();pfield1.setName("firstname");pfield1.setReportName("");pfieldDV1.setValue("bobby");pfieldDV1.setDescription("my description");vals1.add(pfieldDV1);pfield1.setCurrentValues(vals1);fields.add(pfield1);ExportOptions exportOptions = new ExportOptions();exportOptions.setExportFormatType(reportExportFormat);RTFWordExportFormatOptions wordExportFormatOptions = new RTFWordExportFormatOptions();wordExportFormatOptions.setStartPageNumber(1);wordExportFormatOptions.setEndPageNumber(3);exportOptions.setFormatOptions(wordExportFormatOptions);

ReportExportControl exportControl = new ReportExportControl();exportControl.setName("MyExportControl");exportControl.setReportSource(reportSource);exportControl.setExportAsAttachment(exportAsAttachment);exportControl.setParameterFields(fields);exportControl.setExportOptions(exportOptions); exportControl.setOwnPage(true);exportControl.setOwnForm(true);exportControl.processHttpRequest(request, response, request .getSession().getServletContext(), null);exportControl.dispose();

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Post Author: amit_cv

CA Forum: JAVA

I face the same problem on Crystal Enterprise 10. The parameters are not getting set.

Former Member
0 Kudos

Post Author: OlivierM

CA Forum: JAVA

Hi,You can find my JSP file and the RPT Crystal Report Template 10:RPT Report template file:http://www.divshare.com/download/3010083-dcf JSP File http://www.divshare.com/download/3010084-c8eThe Parameter is not replaced. Please tell me if this code works for you or tell me what is missing ...Thanks....

Former Member
0 Kudos

Post Author: OlivierM

CA Forum: JAVA

I think there is a problem with the setParameterFields method of the ReportExportControl, because my parameters are not replaced. Maybe, are there any other Common Hot Fix should be install ?

Former Member
0 Kudos

Post Author: OlivierM

CA Forum: JAVA

Thanks for your response. I have installed the patch and even the sample code found in the tutorial (CR10_JRC_ExportWithParameters.zip of the cr10_jrc_samples.exe) doesn't work on my computer (Missing parameter values).And my previous java code has the same behaviour: the parameters are not replaced.In the sample, I don't want to configure a database, so I moved the database field in the report and keeped only the pfield1 parameter field.In the readme of the patch (Crystal 10 Common Hot Fix), I have read "ii. Copy the JRC JAR files to the WEB-INF/lib directory on your Java application server." So, I have copied the jars files founds in the "C:\Program Files\Fichiers communs\Crystal Decisions\2.5\java\lib" folder into my WEB-INF/lib directory Any ideas to solve my problem ?Thanks.

Former Member
0 Kudos

Post Author: Ted Ueda

CA Forum: JAVA

I'd first try the sample code for JRC 10 found here:

http://resources.businessobjects.com/support/communitycs/FilesAndUpdates/cr10_jrc_samples.exe

Sincerely,

Ted Ueda