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

Stationary templates


sravyts

Recommended Posts

We are currently busy with integrating JasperReports as our reporting tool in our application.

But our software will work in an environment where currently reports are generated using stationary templates. You can consider a stationary template as a bag (with some text and images) that is reused for all generated reports (and these can be very different in turn).

The biggest request for this functionality is that changing the stationary template is sufficient to change all future reports.

 

I have been looking into the query example for using the .ent files but I don't think this is exactly what we need. It would mean that we need to create for each section such an ent file instead of creating 1 stationary template. Furthermore they want to be able to handle such a stationary as a normal design (open it in our designer and add text/images).

 

Is there such a concept that I have missed?

Or are you guys planning to implement something similar?

 

For reusing styles, I very much like the templates (of course). But style only is not sufficient for us, we need some content in different sections as well :-(

Link to comment
Share on other sites

  • Replies 9
  • Created
  • Last Reply

Top Posters In This Topic

What I was thinking about is whether it is possible to extend the templates.

Next to <style> elements, they could contain e.g. <title>, <pageFooter>, <pageHeader> elements which in turn contain report elements.

 

The result when referring to such a template is the merge of all elements in the template and the report on band level.

 

If elements from the stationary fall out of the report's bands, the same error can be thrown that is now thrown when an element falls out of it's own band.

 

Or am I missing something here?

 

Btw: I have tried solving the stationiary/template issue in the following way:

Each stationary I create contains a parameter "template" (type = JasperDesign).

Each template I create contains a parameter "stationary" (type = String)

 

 

When loading a report I always check if it contains a parameter "stationary". If this is the case, I load the stationary in turn; set the parameter "template" to point to my already loaded report's JasperDesign and continue with filling the stationary (and change the name of the JasperPrint to be the report's name instaed of the stationaries name)

 

This works fine. But I have a problem because the details section of the template file does not stretch to fill the complete subreport element in the stationary. Resulting in my subreport being collapsed instead of going to the bottom of the page.

(Are you still following? :whistle: )

Link to comment
Share on other sites

sravyts wrote:

What I was thinking about is whether it is possible to extend the templates.
Next to <style> elements, they could contain e.g. <title>, <pageFooter>, <pageHeader> elements which in turn contain report elements.

The result when referring to such a template is the merge of all elements in the template and the report on band level.

 

The main problem with this is that templates are resolved at fill time by compiled reports, and injecting report content would require the report to be recompiled, which takes some time. So we can either live with this or see whether there's a way to merge "compiled" templates.

 

Also, a report can reference several templates. We'd need to decide how the merge would work in such cases.

 

This works fine. But I have a problem because the details section of the template file does not stretch to fill the complete subreport element in the stationary. Resulting in my subreport being collapsed instead of going to the bottom of the page.

 

Should I understand that the actual report is used as a subreport in the stationary? If this is the case, the subreport would normally stretch to accomodate its contents. Could you post such a stationary JRXML?

 

Regards,

Lucian

Link to comment
Share on other sites

Attached is the stationary that I'm using.

 

The subreport seems to stretch (see the static text I added below the subreport) , but the details section of the subreport doesn't stretch (I have a pagefooter in the subreport but this isn't shown at the bottom of the space provided for the subreport, like if I view the report itself (so not using it as a subreport).

[file name=stationary.jrxml size=3137]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/stationary.jrxml[/file]

Link to comment
Share on other sites

Ok, I see now. The problem is that the subreport page footer is not printed at the bottom of the space available for the subreport.

 

This is a by design behaviour of JasperReports. However, I remember people expecting subreport page footers to be rendered at the bottom of the page even when the subreport does not consume the entire master page, so it might be useful to have introduce flag that controls this. If you want to see this implemented in JasperReports, please log a feature request here.

 

Regards,

Lucian

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