Multi Line Text Field, dynamic display

0

My problem is trying to get a multiple line text field to dynamically move up if the extra lines are empty towards the bottom

E.g if I have a 3 line text field by 10 chars wide. This field can be filled with variable lengths of string.

So If I have a string that is 7 chars long I only want the 1st line to appear, and not the other 2 lines below it.

I have tried checking the remove line when blank but that only appears to work for whole text fields.

Do you guys have any ideas on how I could accomplish this in the tidiest manner,

currently I am thinking of using 3 seperate text fields, an expression with substring and print when expressions, etc.

 

I am using jasper-reports 3.0.0.

 

macalase's picture
Joined: Mar 12 2009 - 8:00am
Last seen: 5 years 9 months ago

5 Answers:

0

If I've understood correctly your question, you have a textfield with height = 30 (let's say 10 per line) because the string which dynamically fills that textield MAY BE long enough to occupy the entire textfield.

You should try to set the textield's height as it was to contain always only one line of text (i.e. 10) and mark the property: "stretch when overflow". This will cause textfield's height to increase to contain the full text of the string.

 

jmmartinv's picture
Joined: Mar 12 2009 - 2:14am
Last seen: 10 years 1 week ago
0

If I set the text field to be height of 30, and only the first line is needed, it uses up the extra 2 lines that I have provided for it. It will not dynamically move up with the empty space.

If i set it to be heght 10 and use the "stretch when overflow" option and I have tried both options for stretch type. "Relative to tallest object" and "Relative to band height".
The text field only displays the first line, and does not push down the report to display the extra lines.

 

 

 

macalase's picture
Joined: Mar 12 2009 - 8:00am
Last seen: 5 years 9 months ago
1

the option "Stretch type" doesn't matter, just leave it at "No stretch".

Just checking the "stretch with overflow" option should make the textfield resize to show all the text.

Maybe the textfield is resizing but you have another element (textfield, static text, whatever...) just below the textfield which is overlapping the textfield when it resizes?

Checking the "stretch with overflow" option only tells the textfield to resize, but it doesn't make the elements below the textfield to "go down". If you want that behaviour for those elements you should set the option "Position type" to "Float" in all of them.

jmmartinv's picture
Joined: Mar 12 2009 - 2:14am
Last seen: 10 years 1 week ago
0

Thanks for the reply, I changed the elements below to all be float.
The text field just doesn't seem to want to stretch vertically. I haven't been able to made it stretch at all.

Is there anything else that may be preventing it to stretch. I have checked the heights of the report, and there is plenty of room for it to stretch.

macalase's picture
Joined: Mar 12 2009 - 8:00am
Last seen: 5 years 9 months ago
0

got it working guys, thanks for the help

My font size was not matching the line height.

macalase's picture
Joined: Mar 12 2009 - 8:00am
Last seen: 5 years 9 months ago
Feedback
randomness