Jump to content

XLS exclusion of bands in generic subreports


roarf

Recommended Posts

  Hi,

I'm trying to exclude some bands in my subreports in Excel-format. I have quite complicated nesting of subreports, but I try to get a simpler example working first.

I have a master report which only consist of a subreport in the "detail 1" band. This subreport uses a datasource expression to get the template at runtime. What I'm trying to do is exclude the "detail 1" band of the subreport for Excel. I put these lines in my master report:

 

<property name="net.sf.jasperreports.export.xls.exclude.origin.band.3" value="detail1"/>

<property name="net.sf.jasperreports.export.xls.exclude.origin.report.3" value="What goes here?"/>

 

At the subreport value I think I have three choices:

1. The subreport key defined in the master report (subreport-1)

2. The subreport expression defined in the master report ( $F{mainDataSource}.getTemplate() )

3. The runtime chosen subreport name, for example (subReport_XXYY) (In so case I have to do these for all subreports..)

 

I also wonder if JasperReports 3.6.1, which I'm currently using, support these functions.

Any help will be much appreciated, as I can't get this to work:)  

 



Post Edited by roarf at 03/16/2010 09:12
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Finally got it working, had to use the subreport implementation name ( same as filename without .jasper exstension).

Not the generic beautiful way I was hoping for but..:) 



Post Edited by roarf at 03/19/2010 12:39
Link to comment
Share on other sites

  • 4 years later...

Old topic, but I post this message to add some explanations.

Context : a report called "MyMainReport.jrxml" including a subreport called "MySubreport.jrxml"

Aim : hide title, page header and page footer bands when the main report is exported in csv format

Solution : add this properties in the main report "MyMainReport.jrxml"

    <property name="net.sf.jasperreports.export.csv.exclude.origin.band.1" value="title"/>
    <property name="net.sf.jasperreports.export.csv.exclude.origin.band.2" value="pageHeader"/>
    <property name="net.sf.jasperreports.export.csv.exclude.origin.band.3" value="pageFooter"/>
    <property name="net.sf.jasperreports.export.csv.exclude.origin.band.0101" value="title"/>
    <property name="net.sf.jasperreports.export.csv.exclude.origin.report.0101" value="MySubreport"/>
    <property name="net.sf.jasperreports.export.csv.exclude.origin.band.0102" value="pageHeader"/>
    <property name="net.sf.jasperreports.export.csv.exclude.origin.report.0102" value="MySubreport"/>
    <property name="net.sf.jasperreports.export.csv.exclude.origin.band.0103" value="pageFooter"/>
    <property name="net.sf.jasperreports.export.csv.exclude.origin.report.0103" value="MySubreport"/>

 

For more infos, see http://community.jaspersoft.com/wiki/how-can-i-suppress-page-headers-and-footers-when-exporting-xls
 

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...