Skip to Content
author's profile photo Former Member
Former Member

Export report as RTF file with parameters

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();

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 03:48 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 11:11 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 03:10 PM

    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 ?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2007 at 04:29 PM

    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....

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2008 at 08:08 PM

    Post Author: amit_cv

    CA Forum: JAVA

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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.