[#8956] - Excluding group bands based on export type resulting in blank rows when exporting as PDF

Category:
Bug report
Priority:
Normal
Status:
Confirmed
Project: Severity:
Major
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:

I am attempting to create reports that can be exported in either PDF or in XLS/XLSX. These reports need to have a different layout depending on the export type. I am trying to accomplish this by creating multiple groups, and using properties to exclude specific group bands based on export type.

Excluding these bands works as expected when the export type is XLS or XLSX, but when the export type is PDF a blank row is left behind where the band I excluded would have appeared.

Here is an example of the properties I'm using:
<property name="net.sf.jasperreports.export.xlsx.exclude.origin.group.1" value="Customer-PDF"/>
<property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.1" value="groupHeader"/>

<property name="net.sf.jasperreports.export.pdf.exclude.origin.group.2" value="Customer-XLS"/>
<property name="net.sf.jasperreports.export.pdf.exclude.origin.band.2" value="groupHeader"/>

I have attached an example .jrxml file that uses the Sample DB to illustrate the issue. I've also attached example output.

AttachmentSize
Binary Data bugexample.jrxml18.72 KB
ggeeslin's picture
Joined: Sep 18 2015 - 10:20am
Last seen: 5 years 3 months ago

1 Comment:

#1
  • Status:New» Confirmed
  • Assigned:nobody» teodord

Hi I give it a try to your sample and I can confirm the problem.
I gave a quick read to the JR documentation but it appears to me that the properties are set properly.
After I looked into the XML structure I noticed that the "Customer-PDF" group (excluded in XLS, XLSX) contains two bands in the group header, while there are two groups with one band each for the group headers to be excluded by the PDF exporter. You have "Customer-XLS" and "PositionNo-XLS" groups.
Given the output result I suspect there is bug in JasperReports in how it processes the properties: it's like it consider only the first group.

Anyhow there is a workaround that works and that uses a wildcard for PDF exclusion. So something like the property below:
<property name="net.sf.jasperreports.export.pdf.exclude.origin.band.2" value="groupHeader"/>
<property name="net.sf.jasperreports.export.pdf.exclude.origin.group.2" value="*-XLS"/>
This way it will catch the two group headers.
Another solution is two reproduce the same situation (if possible) you have for the Customer-PDF group where you have two bands in the header. In that case it should work fine too.

I will move the bug to the JR team so they can investigate further and decide if it is really a bug (and fix it), or maybe they can advice on how to use better the properties/design the report.
Best regards,
Massimo.

AttachmentSize
Image icon jrxmltree.png517.21 KB
Feedback
randomness