Thursday, September 19, 2013

Control line spacing in ireport

Is it possible to control the line spacing in ireport ? Yes

I have recently come through this problem during one of project as the requirement was to have something line the following
 but what I had by defaut in ireport is


The question is How to reach my target of reducing line spacing ?

This is easily achievable in ireport (version 5.00 ) . In fact ireport offer various properties for controlling line
  spacing . If you click on a textfield and go to properites you get the following options
 line spacing has many options available :
  •  single (default)
  • 1.5
  • Double
  • At least 
  • Fixed 
  • Proportional
If you set it to fixed , you can control line spacing by entering different value in line spacing size .
For the remaining option s, you can easily test them yourself.

Note:
I assume you can insert a newline in ireport , if not here is how you can do that using \n.
As in the preceding example , we want to insert four (04) fields in a single textfield and each appearing in a newline.

$F{empName}+"\n\n"+$F{comment1}+"\n"+$F{comment2}+"\n"+$F{comment3}

Hope you find it useful.


No comments:

Post a Comment