Jump to content
Changes to the Jaspersoft community edition download ×

Printing a report twice


dirk191

Recommended Posts

Hello,

 

we are using a programm with jasperreport 2.0.2 integrated.

Now i have to figure out how two print die hole report twice without changing the programm.

The page should only printed twice if a parameter cantains a special string.

Is that possible?

 

I´ve tried to add a Subreport at Summary passed the connection and map and copied the report completly to the subreport.

But that dosn´t worked. I only get an empty page at the end .

I´ve also tried to put the subreport in the Titel.

Everytime somthing is missing.

 

Some Information:

My original report is using following bands: pageHeader, detail, lastPageFooter

It didn´t use report query.

 

Greets

Dirk

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I think your post is in the wrong section, it should in the jasperreport forum.

What I understand is that you want to print the whole report twice,maybe you can use the PrintRequestAttributeSet.

 

 

I hope it helps,

Fathi

Code:


Post Edited by fathi at 07/10/2010 09:50
Link to comment
Share on other sites

Hello fathi,

 

first thanks to you for your reply.

 

I´ve postet in the iReport Section because I'm using iReport for creating the report.

I'm not familiar with creating the xml with notepad.

 

Your code seems to be Java that must be in the calling programm.

But I can´t change the programm and searching for a possibility to do it in the report.

Or  is my suggestion wrong? Then please tell me where to put the code in iReport or direkt in the XML-File

 

Thanks, Dirk191

Link to comment
Share on other sites

I misunderstound your post, I thought you can change the programm integrating jasperreports.

I am not so familiar with ireport, but I don't know how or if it is possible to set the number of copies directly in the report

Sorry,

 

Fathi

Link to comment
Share on other sites

 I have a suggestion : put the page which can be duplicated in a detail band and add a new detail band after with the same page and set the "Print when" property of this second band to true or false according the value of the piloting variable. You may have to adjust with a "Page break".

I never tried, but this theorically should work.

Edit : Sorry I didn't catch that you want to print twice the whole report. My suggestion is not adequate.

You say that you tried to use subreports. It seems a good idea : insert twice your report as sub-report in a main report summary band and use the "Print when" property of the second sub-report to print it or nor according to the value of your parameter.

But you must be aware that the page numbers (if any) wo'nt be the same in the duplicate report than if you print it twice via printer interface.



Post Edited by Gaby38 at 10/08/2010 11:49
Link to comment
Share on other sites

Hello Gaby,


thanks for your hint.


I´ve took a copy of the original report, deleted all Fields and  put the report as two subreports in  summary band.

At Supreport(Other)  I´ve tried with copy from Master and also only with Report_Parameters_Map.

But I only get an empty page.

I didnt use print when expression for the first tests.

If I put a static text on the new report holding the subreports, this ist the only I see on the print.



Some more informations:

I didn´t use Pagenumbers

The report normaly has only one page

 

Greets, Dirk
 

Link to comment
Share on other sites

 Dirk,

To check the basic mechanism, I suggest not to use your standard query.

In the main report, as well as in the subreports, define a "dummy query" like "Select 1" or "Select 1 from dual" if you use oracle. In the main report you put a static text "Main Report", and also in the two sub reports : "Report1" and "Report2".

In the "mapping" of parameters in the main report for the sub-reports, you only define the datasource as a connection, the same as the main report ($P{REPORT_CONNECTION}.

If you run this report, you should see the 3 static texts.

After that, you set the real queries with the real fields, first in sub-report1 then in the two sub-reports : you should see twice the same thing.

After, you should be able to pilot the duplication with the "Print when" property.

Hope this helps you.

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