Jump to content
We've recently updated our Privacy Statement, available here ×

Exclude page footer when export to xls


hahagal

Recommended Posts

Hi,

I need to exclude the page footer when exporting to xls. My page footer has a subreport and 2 textfields. I able to exclude the subreport.. but unable to exclude the 2 textfields. I have the followings set.

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

<property name="net.sf.jasperreports.export.xls.exclude.origin.report.2" value="footer_landscape_A4"/>

Link to comment
Share on other sites

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

You just blew my mind.  I don't know the answer to your question, but I'm having to do more reports that are ultimately designed for export to CSV, and I really don't like having to create a report that has NO title or column headers, etc. just so it can be exported.  I would LOVE to be able to have the report still have a few extras while you are viewing in JasperReports Server or if you export to PDF, but then have those bands automatically be ignored when exporting to CSV specifically.  Even though you're having problems with part of it, it sounds like you've had some success.  Can this be done on a report-by-report basis, or how are you accomplishing this?

Carl

Link to comment
Share on other sites

It sounds like you have some success in supressing certain elements of a report when you export to xls, and I'd never heard that was possible before.  I'm very interested, and I wasn't sure if you were putting the property specifications you listed directly into the jrxml of the specific report or if there is a place in iReport designer view where you can set this or if you had to go in and set something special in a configuration file for the exporter (which would affect all files you export to xls) or...

I like to help respond to questions when I know the answer, but in this case your question tells me that you already know more about this than I do, and I was trying to at least get caught up to where you are, because I can see how useful it would be to be able to write a report that looks one way in JasperReports Server or in PDF but has some of the "extras" automatically stripped out if you go to export to CSV or XLS.  I mostly stay away from SubReports, so I may not be able to help with your specific problem, but I'd love to start experimenting with these properties you're working with, and maybe I'll be able to help someone with a question about it in the future.

Carl

Link to comment
Share on other sites

Okay, as I said, I don't use subreports much, but I have played around with this exclude capability, and it looks to me like when you use these two lines:

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

<property name="net.sf.jasperreports.export.xls.exclude.origin.report.2" value="footer_landscape_A4"/>

I think you're just saying to exclude the pageFooter from the subreport called "footer_landscape_A4".

If what you're trying to do is to exclude the pageFooter from your main report, you don't specify a .report extension.  You would just have the first line and not the second line.  On the other hand, it's possible that the report won't let you suppress a band unless you also suppress every band of every subReport in that band???  If so, it would be a pain, but I guess it would look something like this, depending on what bands you use in the subReport:

<property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="title"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.report.2" value="footer_landscape_A4"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.3" value="pageHeader"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.report.3" value="footer_landscape_A4"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.4" value="columnHeader"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.report.4" value="footer_landscape_A4"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.5" value="detail"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.report.5" value="footer_landscape_A4"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.6" value="columnFooter"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.report.6" value="footer_landscape_A4"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.7" value="pageFooter"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.report.7" value="footer_landscape_A4"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.8" value="summary"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.report.8" value="footer_landscape_A4"/>

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

Of course, if your subReport has groups or contains subReports of it's own, then it would be even more complicated.  I haven't tested trying to exclude a band that has a subReport, but thanks to you, I WAS successful in writing a report that has a title, columnHeader, detail, pageFooter, and summary, and automatically suppressing all but the detail when I export to CSV, XLS, or XLSX (which seems to follow whatever directions you give the xls exporter).  Thank you.

Carl

Link to comment
Share on other sites

As this thread is very new and I have similar problems, I allow to join here for my very first post  /tools/fckeditor/editor/images/smiley/msn/wink_smile.gif.

With the help of all answers from this topic, I have been able to successfully suppress for excel export a detail section containing a subreport as well as page header and footer. Now, there is one remaining problem: All contents are suppressed as I wanted, but the empty bands remain in the excel export, still wasting their space. How can I get rid of them?

I have already tried the following:

- net.sf.jasperreports.export.xls.remove.empty.space.between.rows

- net.sf.jasperreports.export.xls.collapse.row.span

- net.sf.jasperreports.export.xls.auto.fit.row

This makes ALL empty row spaces disappear, but unfortunately, not the empty space of the band containing the suppressed subreport. As I willfully use some empty rows, this removes everything I want to keep and keeps everything I want to get rid of. The first issue, my willfully used empty rows, are no problem - I can keep them by inserting an empty static text field for every one. This is not a very elegant solution, I think, but at least, it fulfills its purpose. But what about the large empty space of my suppressed subreport - I do not have any idea how to get rid of it! I think, it remains, because the subreport only becomes invisible, but it is still printed - so it still uses its space.

Does anybody have an idea how to completely suppress whole bands (not only their contents)? Thank you in advance for your helpful brainstorming!



Post Edited by desperate at 03/12/2012 11:25
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...