16

I've just started using Jasper Reports to generate reports from data retrieved using Hibernate. Everything is working, except JR doesn't seem to respect newline characters (\n) in text fields. Is there a way to force line breaks at newline characters?

5 Answers 5

17

Set the isStyledText to true (tick it) and to break the line use <br/>.

Example:

text + "<br/>" + newLineText
0
8

If you use iReport, you can select the static text area. In the right column you will find the properties of that object. Under "Static text properties -> Text" you will find your text. Click onto the button [...] so that a window opens where you can enter your text including line breaks.

8

if you use Static Text, in Jasper Studio, you can press Shift + Enter

0
5

Set the markup as html then add a <br/>

3

Set the text field expression as:

$F{..}+"\n"+$F{..}

Not the answer you're looking for? Browse other questions tagged or ask your own question.