Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to implementation subreports #159

Open
arnaldocorreaxO opened this issue Jan 27, 2024 · 2 comments
Open

How to implementation subreports #159

arnaldocorreaxO opened this issue Jan 27, 2024 · 2 comments

Comments

@arnaldocorreaxO
Copy link

How to implement subreports in pyreportjasper, do I have errors when trying to process the main report?
image
image

@jadsonbr
Copy link
Collaborator

There is more than one way to use a subreport. One of them is the way you tried, but instead of passing a *.jasper, you should pass a jrxml. Another way is by assigning only the name and extension of the subreport inside the jrxml, and the folder containing all the files that the report needs to pass as a parameter in resource.

Here is a link to an example using the last option. To continue using the current approach, use the jrxml of the subreport instead of the jasper: Example link

Example of how to use the second method mentioned

	<subreport>
		<reportElement x="0" y="0" width="555" height="20" uuid="e0dc40ad-4995-4e54-ae42-82a0a9a58126">
			<property name="local_mesure_unitheight" value="pixel"/>
			<property name="com.jaspersoft.studio.unit.height" value="px"/>
		</reportElement>
		<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).dataSource("/contacts/summary")]]></dataSourceExpression>
		<subreportExpression><![CDATA["header.jasper"]]></subreportExpression>
	</subreport>

Here you can see why we require a jrxml in the way you are currently using.

Code for one of the ways that deals with a subreport

@jadsonbr
Copy link
Collaborator

@arnaldocorreaxO
We had an error processing subreports that was fixed in version 2.1.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants