Jump to content

lilo

Members
  • Posts

    3
  • Joined

  • Last visited

lilo's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. I made a mistake in adding the parameter for the subreports to the main report. It works well actually.
  2. Hi, To be able to translate my reports, I need to use the REPORT_RESOURCE_BUNDLE parameter to define the translation file to use because I can't put it in the classpath : Locale locale = new Locale( "fr", "CH" ); if ( locale != null ) { FileInputStream fis = null; try { String filePath = I_ReportCreator.BASE_PATH_FOR_JASPER + getParentFolderPath( report.getFilePath() ) + jasperReport.getResourceBundle() + "_" +locale.toString()+ ".properties"; fis = new FileInputStream( filePath ); ResourceBundle bundle = new PropertyResourceBundle( fis ); paramName = JRParameter.REPORT_RESOURCE_BUNDLE; parameters.put( paramName, bundle ); parameters.put( JRParameter.REPORT_LOCALE, locale ); } catch( FileNotFoundException fnfe ) { //si le fichier de ressources n'existe pas, on se contente de ne pas l'ajouter } finally { if ( fis != null ) fis.close(); } } I works well for simple reports. But not for subreports. With subreports, jasper ignore the REPORT_RESOURCE_BUNDLE and tries to load the resource file from the classpath. That gives me the error : 20 oct. 2009 17:13:25 net.sf.jasperreports.engine.fill.JRFillSubreport prepareGRAVE: Fill 3945515: exceptionjava.util.MissingResourceException: Can't find bundle for base name i18nreport, locale fr_CH at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1521) at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1260) at java.util.ResourceBundle.getBundle(ResourceBundle.java:962) at net.sf.jasperreports.engine.util.JRResourcesUtil.loadResourceBundle(JRResourcesUtil.java:572) at net.sf.jasperreports.engine.util.JRResourcesUtil.loadResourceBundle(JRResourcesUtil.java:510) at net.sf.jasperreports.engine.fill.JRFillDataset.loadResourceBundle(JRFillDataset.java:533) at net.sf.jasperreports.engine.fill.JRFillDataset.setParameterValues(JRFillDataset.java:568) at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1234) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:865) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:814) at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:561) at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:63) at net.sf.jasperreports.engine.fill.JRThreadSubreportRunner.run(JRThreadSubreportRunner.java:209) at java.lang.Thread.run(Thread.java:619) I noticed in JRFillSubreport.evaluateSubreport, jasperreport does the following : parameterValues = getParameterValues( filler, getParametersMapExpression(), getParameters(), evaluation, false, jasperReport.getResourceBundle() != null,//hasResourceBundle jasperReport.getFormatFactoryClass() != null//hasFormatFactory ); Then, in JRFillSubreport.getParameterValues (removeResourceBundle is the paramter corresponding to jasperReport.getResourceBundle() != null) : if (removeResourceBundle) { parameterValues.remove(JRParameter.REPORT_RESOURCE_BUNDLE); } Why does jasperreport remove this parameter for the subreport ? I tried to manually add <subreportParameter name="$P{REPORT_RESOURCE_BUNDLE}"> <subreportParameterExpression><![CDATA[$P{REPORT_RESOURCE_BUNDLE}]]></subreportParameterExpression> </subreportParameter> to i18nReport.jrxml and it generated well. But how to do that with iReport ? I am using jasperreport 3.5.2 Thank you for your help
  3. Hi, How to do that with iReport ? Thank you
×
×
  • Create New...