Jump to content
JasperReports Library 7.0 is now available ×

page # variables


2005 IR Help

Recommended Posts

By: tim hatzenbeler - timhatz

page # variables

2001-11-20 22:47

2 questions, and the first answer should answer the second..

 

What variable of formula would I use to print

Page 1 of 7

 

or If the total # of pages is not know durring runtime, how about just the simple, Page #5 variable?

 

Thanks, tim

 

 

 

 

By: Teodor Danciu - teodord

RE: page # variables

2001-11-21 01:44

 

Hi, Tim,

 

For the page number there is a predefined

variable called "PAGE_NUMBER".

You can use it in any expression.

 

As for the total number of pages, we use the same

variable but in a text field for witch we have

to set the attribute "evaluationTime".

(see "Quick Reference" for details)

 

Check the page footer section in the FirstJasper.XML

file supplied in the sample to see how it is done there.

 

I think I'll explain that in the "Tips & Tricks".

 

Here are the sequences you can use:

 

Current page number:

 

Code:
<textField> 
<reportElement x="200" y="10" width="75" height="20"/>
<textElement textAlignment="Right">
<font fontName="Helvetica" size="14"/>
</textElement>
<textFieldExpression class="java.lang.Integer">
$V{PAGE_NUMBER}
</textFieldExpression>
</textField>

 

Total number of pages:

 

Code:
[code]<textField evaluationTime="Report">
<reportElement x="280" y="10" width="75" height="20"/>
<textElement textAlignment="Left">
<font fontName="Helvetica" size="14"/>
</textElement>
<textFieldExpression class="java.lang.Integer">
$V{PAGE_NUMBER}
</textFieldExpression>
</textField>

 

I hope it helps.

Teodor

 

 

 

 

 

By: tim hatzenbeler - timhatz

How about this...RE: page # variables

2001-11-21 14:07

It worked.... But.... Can I do this?

 

Can I create a formula, similar to:

Code:
[code]<textFieldExpression>
$F{FirstName} + " " + $F{LastName}
</textFieldExpression>

 

 

But using 2 runtime versions of Page Number?

Code:
[code]<textFieldExpression>
"Page "+$V{Current_Page) + " of " + $V{Total_Pages}
</textFieldExpression>

 

In other words, and I set, the Page_number Variable to another variable, durring the report?

 

Also, last week, I attempted to send you some cross-tab examples... I was wondering if that e-mail made it to you? I had 3 other out going e-mails fail that day... Thanks, tim

Post edited by: tcloonan, at: 2006/08/12 18:06

Link to comment
Share on other sites

  • 3 years later...
  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

  • 1 month 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...