Jump to content
JasperReports Library 7.0 is now available ×

iReport & XML - page number


joe

Recommended Posts

Hi,

 

I am trying to create a report whose data come from an XML-File, using subreports.

 

However I just can't figure out yet how to print out the right page number in the footer.

 

I can print out the whole number of pages (e.g. 23) but I actually want something like this:

data set 1 (2 pages): 1/2, 2/2

data set 2 (1 page): 1/1

 

Anyone knows how to deal with this?

 

Thanks in advance :)

 

joe

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Joe,

What you may do is this:

In each of your subreports, use your page footer band.

In each of your page footer bands create two(2) TEXT FIELDS (TF1 & TF2).

Just make sure that the text fields are wide and high enough to fit the size of the text you will be using. :)

TF1 is for your CURRENT page number.

TF2 is for the TOTAL number of pages in your CURRENT SUBREPORT.

 

Right click on TF1 > Properties > Text Field tab

Set the Element Properties:

Text Field Expression Class: java.lang.String

Evaluation Time: Now

Stretch with overflow: check

Text Field Expression: $V{PAGE_NUMBER}

 

Do the same for TF2 except for the following -

Evaluation Time: Report

 

NOTE: You should use the same Variable which is $V{PAGE_NUMBER}... Evaluation Time "NOW" causes the variable to increment every time the contents of your detail band overflow to the next page. Evaluation Time "REPORT" will evaluate the variable's value only once, that is when the end of the report is reached.

 

I hope this helps.

 

 

Edwin

Link to comment
Share on other sites

Hey,

 

I think thats the 2nd time ou helped me out :) thanks.

 

It isn't 100% what I meant but placing text fields into the subreport seems like a very good tip.

 

(My first idea was to place these text fiels into the master report, but this doesn't seem to work).

 

joe

Link to comment
Share on other sites

Joe,

That's cool! That's what forums are for, man.

I admit that I'm no expert... not yet, but I'm always happy to know I was able to help someone out in some way.

I'm definitely sure you'll do the same for others when you can.

 

Suggestions may not be the exact solution but they do allow new ideas to come up.

... sometimes seemingly crazy (out of this world) but effective ones, none the less.

 

To quote the founder and chief architect of iReport, Giulio Toffoli in his Aug 2006 Developer of the Month interview:

 

"A great part of the success of iReport comes from the community. ... No one can be an expert of everything, but it is often easy to find someone in the community more skilled than you about a specific topic and willing to share his knowledge. This is why I love the open source!"

(http://www.jasperforge.org/index.php?option=com_content&task=view&id=166&Itemid=279)

 

Personally, I believe that helpful knowledge is something to be freely shared with others... good knowledge should be free.

 

 

Edwin

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