Jump to content
Changes to the Jaspersoft community edition download ×

TextField cannot display static text?


2005 IR Help

Recommended Posts

By: David Lim - aberrant80

TextField cannot display static text?

2004-03-04 20:26

Due to an unfortunate requirement that reports be general and dynamic for me, I needed to prepare for static text that are known only at runtime.

 

The problem is, I tried using JRDesignTextField for displaying static text due to its stretching capabilities. But nothing comes out.

 

JRStaticText works, but I must specify height and width for the text (which means to calculate height and width based on font!!!).

 

My question is if there's any way I can get JRDesignTextField to print only static text?

 

And maybe even teach me how to calculate text size based on font?

 

 

 

 

By: Teodor Danciu - teodord

RE: TextField cannot display static text?

2004-03-07 00:43

 

Hi,

 

You can place static texts inside text fields if you

use a quoted strings as expression.

 

<textFieldExpression>"My static text"</textFieldExpression>

 

If you need to programatically set the expression in

you text field, do not forget the quotes. You need

to "escape" them when you build the expresion.

 

expression.setText(""My static text"");

 

I hope this helps.

Teodor

 

 

 

 

 

By: David Lim - aberrant80

RE: TextField cannot display static text?

2004-03-07 01:54

Actually, I've tried that already. Didn't seem to work; meaning the textfield either didn't appear or it didn't stretch.

 

I find it almost impossible to try to figure out why a textfield doesn't appear in the PDF. the text field is inside the elements of the band, has x/y/width/height all within the boundaries of the page, band and margins. but not seen in the PDF.

 

 

 

 

By: David Lim - aberrant80

RE: TextField cannot display static text?

2004-03-07 04:37

Ignore my previous message. It seems my culprit was my printWhenExpression. Can someone please correct me if I'm wrong?

 

In the summary band, I created a JRDesignTextField that has x = y = width = height = 0. It has no text but has the following in the printWhenExpression: SCRIPTLET_LAST_PAGE_REF + ".setLastPage(true)";

 

In the page footer band, I may have multiple JRDesignTextElement, JRDesignGraphicElement, and JRDesignImage which all will have the following in their printWhenExpression: SCRIPTLET_LAST_PAGE_REF + ".isLastPage()";

 

where the constant is just a casting of $V{REPORT_SCRIPTLET} to my own scriptlet class.

 

Can I do something like this? and expect the page footer elements to know when it is at the last page?

 

 

 

 

By: Teodor Danciu - teodord

RE: TextField cannot display static text?

2004-03-07 05:26

 

Hi,

 

This should work.

But I would use the <printWhenExpression> of the

summaru band itself and make sure the setLastPage()

always returns Boolean.FALSE.

 

I hope this helps.

Teodor

 

 

 

 

 

By: David Lim - aberrant80

RE: TextField cannot display static text?

2004-03-07 18:19

It certainly did help Teoder, it certainly did. Phew! Another problem solved. I tried that originally actually, but some class cast error came up cos it didn't occur to me to return a Boolean.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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