Jump to content
Changes to the Jaspersoft community edition download ×

Rendering Multi-Line text boxes. JasperReports 4.5


rimmeraj

Recommended Posts

We are having a problem rendering a multi-line textField. We are filling the report on a Linux server and then rendering it on a Windows client. The problem is Jasper is taking our box size to be what the fill thought the size needed to be not what we defined in the report. The textField is configured to be non stretch. Thus on a 3 line textField under windows line 3 is dropped but works fine on MAC and Linux.

 

It looks like the problem is in net.sf.jasperreports.engine.export.AbstractTextRenderer.private void renderParagraph(
        AttributedCharacterIterator allParagraphs,
        int lastParagraphStart,
        String lastParagraphText
        )

Line 531

 

if (drawPosY + lineHeight <= text.getTextHeight())

 

TextHeight is the calculated height by the fill. I think it should be text.getHeight() which is how big we declared the text element or max(text.getHeight(),text.getTextHeight()).

 

 

 

Link to comment
Share on other sites

  • 2 years later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

We have exactly the same issue here.

It took a while to understand what was going on. We managed to export the JasperPrint via JasperExportManager.exportReportToXmlFile and load it on the client and then, tweeking the XML, we got to the textHeight attribute of the text element.

And got here after searching for jasperreports textHeight windows

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