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

Last line not shown in Text Field


julianost

Recommended Posts

Hi there!

This question was already been asked by others but the answers did not fit my needs. I have a Text Field with "stretch with overflow" checked that display texts sent by the application. I have a particular text that have an hour in the format "6:40h" in the middle of it. The problem is that the last line of this text is not shown. I searched and discovered that it occurs because when the size of the text field is calculated the "6:40h" is broken in two lines: "6:" in the end of one, and "40h" in the begin of the next. But when it is rendered in PDF it appears whole in the begin of the next line. So, the size of the field is calculated for six lines, but the text displayed have seven lines. I'm using jasperreports version 5.6.0. I found two solutions for this:

1) Insert a "n" at the end of the text to add an extra line.
- The problem of this solution is that it inserts an empty line of text when it is not needed most of times, and the document must be very tight. And also can result in a extra page.

2) Use the property net.sf.jasperreports.export.pdf.force.linebreak.policy = true. This makes the PDF renderer to break the hour the same way that the size of the field is calculated.
- The problem of this solution is that it shows the hour "6:40h" in two lines, making "6:" appears in one line and "40h" in the next, and this the client probably will not accept.

And it may be that the problem are the fonts. This specific problem happen only if I use Arial. But if I change to another font, it does not happen. But of course, this occurs because doing this makes the hour not being in the end of a line, not making the two calculations differs, so the problem does not occur. I also tried net.sf.jasperreports.print.keep.full.text, but nothing happened.

So, there is a third solution to it? I think the best way would be to ensure that the hour is not break when the size of the text field is calculated, but I didn't find any way to configure this.

Thanks for the attention!

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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