Reputation: 985
I have a jrxml file and want to add a subreport expression. But I have only myFile.jrxml and cannot pass a jasper file. Is it possible to compile my jrxml file to a jasper file not with java code, but in the current jrxml file? And if possible, how to do this?
<subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR}+"/myFile.jasper"]]></subreportExpression>
I tried:
<subreport isUsingCache="true">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression class="net.sf.jasperreports.engine.JasperReport"><![CDATA[net.sf.jasperreports.engine.JasperCompileManager.compileReport(net.sf.jasperreports.engine.xml.JRXmlLoader.load($P{SUBREPORT_DIR} + "myFile.jrxml"))]]></subreportExpression>
</subreport>
but an error occured: SEVERE: Error evaluating expression : Source text : net.sf.jasperreports.engine.JasperCompileManager.compileReport(net.sf.jasperreports.engine.xml.JRXmlLoader.load($P{SUBREPORT_DIR} + "myFile.jrxml"))
Upvotes: 2
Views: 3070
Reputation: 347
<subreportExpression>
<![CDATA[JasperCompileManager.compileReport($P{SUBREPORT_DIR}+"/myFile.jrxml")]]>
</subreportExpression>
Upvotes: 3
Reputation: 11
Yes, it is possible, I am unaware of the codes used here, just open iReport 5.0. Open the .jrxml
file it will show the conversion option readily on the screen. Give a path for saving .jasper
file. Now you have .jrxml
and it's editable jasper
.
Upvotes: 1
Reputation: 981
From what I've read in the Ultimate Guide the answer is no, it is not possible. Why are you unable to compile the subreport to a jasper file?
Upvotes: 2