Kazade
Kazade

Reputation: 1327

New lines in Jasper Reports?

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?

Upvotes: 16

Views: 52984

Answers (5)

user14574790
user14574790

Reputation: 31

Set the text field expression as:

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

Upvotes: 3

angel molina
angel molina

Reputation: 61

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

Upvotes: 5

Cristiano
Cristiano

Reputation:

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

Example:

text + "<br/>" + newLineText

Upvotes: 17

sfblap
sfblap

Reputation: 171

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

Upvotes: 8

vespa
vespa

Reputation: 81

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.

Upvotes: 8

Related Questions