PHPJasper - SubReports - 填写reportResource时找不到错误:

I have a main report and a subreport working fine in Jaspersoft. (data from mysql) I'm trying generating a pdf using PHPJasper (geekcom), but I have the following problem:

Error filling reportResource not found at: subreport.jasper

I assume it's just a problem at this line:

<subreportExpression><![CDATA["subreport.jasper"]]></subreportExpression>

Both reports are at same folder

How to set the path?

You could parametrize an absolute path to the subreport:

  1. In the main report, create a new parameter, e.g. subreportsPath, class java.lang.String

  2. In this parameter subreportsPath properties, search for "Default Value Expression" and write "."

  3. In the main report editor/design view, click the subreport, find its "Expression" property and change it to $P{subreportsPath} +"/mySubreport.jasper"

Now, you can pass an absolute path to your subreportsPath parameter from your library code, e.g.

array('subreportsPath' => 'C:/project/reports/reportX')