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

How do you make a text field "push" other values


kurt_cobain

Recommended Posts

This seems simple, but I'm having a hard time figuring it out. I have a line like this:

 

"This is [text field] just a test"

 

The value of text field varies; it's a value from the database. I'd like to make it a certain size field, but if it's larger, "push" the rest of the sentence (i.e. 'just a test') over as needed. I've defined the position type as "float" and it still doesn't work. If I make the field too small, then its value gets "jumbled over" the string 'just a test'. If I make the field to big, I get something like this:

 

"This is valueÂÂÂÂÂÂÂÂjust a test"

 

I'd also like to make the text field left justified... thanks

Post edited by: kurt_cobain, at: 2008/05/07 13:46

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

positionType="float" only pushes down/vertically a report element. There is no feature to push an element to the left, the positions of the elements on the horizontal axis are fixed.

 

The only thing you can do is to combine the two texts into a single element, i.e. something like

Code:

<textFieldExpression>$V{value} + " just a test"</textFieldExpression>

 

Regards,

Lucian

Link to comment
Share on other sites

The reason that won't work is I need to make the text field bold and the text itself regular... unless there's a way to do that. As far as I can tell bolding, underlining etc only works with one "unit" and you can't mix within a unit such as a text field - can you?

 

Another thing is, this field is actually a subreport that returns back a name based on a query and such..

Post edited by: kurt_cobain, at: 2008/05/07 18:54

Link to comment
Share on other sites

kurt_cobain wrote:

The reason that won't work is I need to make the text field bold and the text itself regular... unless there's a way to do that. As far as I can tell bolding, underlining etc only works with one "unit" and you can't mix within a unit such as a text field - can you?

 

You can, using styled text. See the "styledtext" JasperReports sample.

 

Another thing is, this field is actually a subreport that returns back a name based on a query and such..

 

If the text field itself is in the subreport, there's no solution for this. But if the String value is returned from a (possibly empty) subreport, you can still use styled text to display the value in the master report.

 

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