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

Print When on Output Type


Recommended Posts

Hello -

I have not been successful searching this site for an answer, and I just purchased doc before 3.7.1 was released!

I have used print-when in many cases.  Now I understand that with 3.7 there is a "print when" capability matching on output type (exporter) but I can not find any doc for using that (print this way if html, print that way if XLS, etc.)

Thanks to the community for any help with this.

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

  • 1 year later...

I have searched high and low as well and while there is property which allows you to conditionaly print bands based on the export type (there is a recent post on that) there doesn't appear to be a property which tells you what the output type is and sometimes suppressing at the band level just doesn't suit your needs.  In my case we have embedded JasperReports into our web application and the user can select the output format (and switch between them) in some cases such as hyperlinks to application functionality I only want to include the hyperlink if the output type is HTML but not when PDF or Word as these are files that can be distributed and hyperlinks won't work. 

To get around this problem, when we embedded jasperReports we determine what the output type is based on user selection and then we automatically set a report parameter called outputType (string) which then can be used for whatever we want and it automatically gets set for every report.

Now on my hyperlink or any expression for that matter I can use the outputType to control what I like 

$P{outputType}.equals("PDF") ? "Do something for PDF" : "Do something when not PDF"

Not sure if this helps your situation but works well for me.

J

 

Link to comment
Share on other sites

I'm not sure whether it meets folks' exact needs , but this is the property that people may have been thinking of:

net.sf.jasperreports.export.{format}.exclude.origin.{suffix}.{arbitrary_name}

It's described in the Configuration Reference, and there's better info in the FAQ. It allows you to hide a band for a particular exporter. For example, hide page footers in html.

Regards,
Matt

Link to comment
Share on other sites

Thanks Matt, that one works perfectly if you are looking to exclude the entire band.

 

I have found situations (for my implementation) where I wanted to determine output in a text element specifically within hyperlink expressions based on the output type and therefore it didn't suit perfectly, could have gotten around it by having multiple bands and switch between them based on the exclude.origin property but that is a bunch of extra work and I am lazy

 

 

 

Link to comment
Share on other sites

  • 5 years later...

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...