Как сделать высоту текстового поля динамической jasperreports
» Live as if you were to die tomorrow. Learn as if you were to live forever.. »
— Mahatma Gandhi
How To Make Text-box Height Dynamic With Content In Jasper Report, Jaspersoft Studio
While developing reports, its a common requirement to have the textbox height dynamic which should increase or decrease based on its content.
To achieve this in JasperReport is a bit tricky, because here we need to handle the textbox dynamic height along with all other objects position and height relative to the textbox in that specific band/section of the report.
So here are the steps to follow:
So here is the steps to follow:
1- Mark the textbox property Stretch With Overflow as checked(in Jaspersoft Studio)
2- Mark the Stretch Type attribute as Relative To Tallest Object for all elements in the same band/section which need to be stretched along with the textbox.
3- Mark the Position Type attribute as Float for all elements which are below the textbox in the same band/section of the report and needed to move down/up based on the height of the textbox.
How to stretch textfield in a JasperReport as per dynamic content?
Just add the isStretchWithOverflow=»true» to the textField that you want as an element.
![]()
![]()
- Click on the particular textfield in iReport.
- On the right side, see TextField properties.
- Check the option «STRETCH WITH OVERFLOW».
It worked in my case.
![]()
![]()
Got the solution. Modified all the static text fields and all the elements properties to positionType=»Float» .
![]()
If you are using Jaspersoft Studio, click on the text field you want to change, navigate to its properties, enter the Text Field tab and change Text Adjust to StretchHeight (default is CutText ). Also, if your text field is in the frame, you should set its Position Type to Float
![]()
The textAdjust=»StretchHeight» with positionType=»Float» solves the growth problem inside a field, but in a list-like layout (but you don’t want to make a list) the neighboring fields stay in place.

I found a solution with frames by trial and error.
Create a frame with <frame><reportElement positionType=»Float» . /> . </frame> around the 2 fields and the static text. You can also use the drag and drop functition in Jaspersoft Studio.
It will look something like this: 
Result:
How to stretch textfield in a JasperReport as per dynamic content?
![]()
Just add the isStretchWithOverflow=»true» to the textField that you want as an element.
![]()
![]()
- Click on the particular textfield in iReport.
- On the right side, see TextField properties.
- Check the option «STRETCH WITH OVERFLOW».
It worked in my case.
![]()
![]()
Got the solution. Modified all the static text fields and all the elements properties to positionType=»Float» .
![]()
If you are using Jaspersoft Studio, click on the text field you want to change, navigate to its properties, enter the Text Field tab and change Text Adjust to StretchHeight (default is CutText ). Also, if your text field is in the frame, you should set its Position Type to Float
![]()
You can add attribute isStretchWithOverflow set is true <textField isStretchWithOverflow=»true»>
![]()
The textAdjust="StretchHeight" with positionType="Float" solves the growth problem inside a field, but in a list-like layout (but you don’t want to make a list) the neighboring fields stay in place.

I found a solution with frames by trial and error.
Create a frame with <frame><reportElement positionType="Float" . /> . </frame> around the 2 fields and the static text. You can also use the drag and drop functition in Jaspersoft Studio.
It will look something like this: 
Result:
Как сделать высоту текстового поля динамической jasperreports
» Live as if you were to die tomorrow. Learn as if you were to live forever.. »
— Mahatma Gandhi
How To Make Text-box Height Dynamic With Content In Jasper Report, Jaspersoft Studio
While developing reports, its a common requirement to have the textbox height dynamic which should increase or decrease based on its content.
To achieve this in JasperReport is a bit tricky, because here we need to handle the textbox dynamic height along with all other objects position and height relative to the textbox in that specific band/section of the report.
So here are the steps to follow:
So here is the steps to follow:
1- Mark the textbox property Stretch With Overflow as checked(in Jaspersoft Studio)
2- Mark the Stretch Type attribute as Relative To Tallest Object for all elements in the same band/section which need to be stretched along with the textbox.
3- Mark the Position Type attribute as Float for all elements which are below the textbox in the same band/section of the report and needed to move down/up based on the height of the textbox.
Как сделать высоту текстового поля динамической jasperreports
First, there is the natural stretch of the element, which is caused by the element growing naturally in order to display its entire content. This is the case with text fields that have isStretchWithOverflow set to true and thus growing in height in order to display all the rows of text that the value of their text field expression provides at runtime.
Secondly, there is the forced stretch of an element, which in addition to its natural growth required by its own content, needs to further grow to match the growing height of some other element that it is put in relation with at report design time.
A forced stretch can be imposed to elements that are part of element groups (JRElementGroup) or element containers (bands, frames, table cells, list cells, etc.). The forced stretch also comes in two flavors.
There is element group stretch and container stretch.
Element group stretch is forced upon an element by the natural growth of the other elements in the same group.
The container stretch is forced upon an element by all types of growth that the container itself suffers, including forced container stretch imposed onto the container by its own parent container.