Jump to content
Changes to the Jaspersoft community edition download ×

miqu

Members
  • Posts

    2
  • Joined

  • Last visited

miqu's Achievements

Newbie

Newbie (1/14)

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

Recent Badges

0

Reputation

  1. I just put some html into a TextField as a parameter. So RTF should be the same just a different TextField Markup setting. You can load Parameters with Default Values. So I suppose If you have the RTF content as a File you can load the file as an inputstream and print it trough that TextField. The TextField: <textField isStretchWithOverflow="true" isBlankWhenNull="false"> <reportElement positionType="Float" x="0" y="54" width="227" height="15"/> <textElement markup="html"> <font fontName="Times New Roman" size="12"/> </textElement> <textFieldExpression><![CDATA[$P{paramNameForYourContent}]]></textFieldExpression> </textField> And setting that Parameter using a oneliner from StackOverFlow to convert inputstream to string: <parameter name="paramNameForYourContent" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA[(new java.util.Scanner(new java.io.FileInputStream(new java.io.File("C:\SomePlace\pathandFilenametoYour.html")))).useDelimiter("\A").next()]]></defaultValueExpression> </parameter> You should just need to change the markup to RTF and load your RTF document. I tested this to work with some html in a file. Post Edited by miqu at 11/08/2011 16:30
  2. Hi Danbos, Heres a few things that I have needed. DataSource Binding to bean containing the SubreportData as a BeanCollection in a Field: <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{fieldNameToBeUsed})]]></dataSourceExpression> If you have trouble finding the Sub JasperReport when creating it from your project. You can put the whole .jasper file as a parameter. You will use parameter Class JasperReport. To be able to use it in Ireport you can use Defaultvalue Expression. You will need to compile each raport by hand if you use this but it is atleast the way to find reports in projects where say EJB container handles the reports and they are coming from another Document store system. <subreportExpression class="net.sf.jasperreports.engine.JasperReport"><![CDATA[$P{parameterNameContainingTheSubreport}]]></subreportExpression> And the Parameter with defaultValue: <parameter name="parameterNameContainingTheSubreport" class="net.sf.jasperreports.engine.JasperReport" isForPrompting="false"> <defaultValueExpression><![CDATA[net.sf.jasperreports.engine.util.JRLoader.loadObject(new java.io.FileInputStream(new java.io.File($P{SUBREPORT_DIR}+"YourSubRaportFile.jasper")))]]></defaultValueExpression> </parameter> In the Subreport you need to add the fields from the subBean and they should be usable. You use the Report Query editor and choose Java Bean DataSource. Choose your class and read attributes and add them as needed. I have been using Jasper for just under a month now but I hope this helps. At least it works for me in iReport 4.1.1 and I do compile it for compatibility with 3.7.4 as our project libs are still a bit old.
×
×
  • Create New...