Stretch elements by overflow in jasperreports - jasper-reports

I have a structure like bellow which consist of one static text and two text fields. The text fields should expand relative to their content. I need to adjust them in a way that these three elements expand together. Should I keep them in one band? What should be the stretch type for each?

Put all three elements in a band.
Set the Stretch Type of Static Text to Relative To Band Height.
Set the same for text field 1.
Set the same for text field 2 and additionally set Position Type to Float.

Related

Changing column properties size

How to change column properties size so as to columns list was expand?
You can make the entire pane larger which will then proportionally make the subpage bigger. Additionally, there's a splitter between the column list and the details pane which allows to change the relative size of both parts.

Detail band resize dynamically vertically when textfield is NULL

I have a JasperReports report build with iReport. I have the normal Detail band but below i have a textField named observations there is sometimes the Observations textField is empty or NULL. I have put both inner components namely textfields, lines into frames something like.
I also set using Print When Expression the below frame the one who holds the Observations textField to appear only when there is data on it this is working very good but the space holds by the frame is still on the Detail and we are losing some space and it's kind annoyng to see this blank space.
Is it possible for the report to "delete" the idle space hold it by the hidden frame?
My report's design:
The generated result (PDF file):
I don't think it's possible to alter the height of a band depending on its content but you can actually have multiple detail bands. So add a new one, move your observation text field into it and set the print when expression of the second band.

multiple horizontally aligned input boxes with vertically aligned labels underneath

I want to create a form similar to this one.
In particular, I want to learn how to put different sized input boxes on the same line with vertically aligned labels underneath. For instance, in the "Name" section of the form, it has a box for "first" and "last."
How can you do this with HTML and CSS?
You sample form contains SPAN elements with display property set to inline-block, and the INPUT and LABEL elements each have a display property value of block, with a fixed size. That way, you are basically creating cells to contain your elements and their labels.
The same thing could be achieved using TABLE/TR/TD combination, though it would be a little old-fashioned, and thus not recommended.

How to set automatically min width of fields by longest text in some group

I use iReport to create reports, and I would like to know if there is a way to set the width of "optically grouped fields". They should be set to the minimal size that still displays longest text. I have Static Text on left side and Text Field right of them. This Text Fields are set to the width 150 and alignment to right, but I'd like to set smaller size to wipe out white spaces.
Consider some thing like this
Name: Paul
Surname: Smither
And want automatically to
Name: Paul
Surname: Smither
etc. can be smaller then preset size but no bigger.
Is there a way?? even some component
You cannot change the element width dynamically without using Java frameworks.
The quote from JasperReports Ultimate Guide:
ELEMENT SIZE
The width and height attributes are mandatory and represent the size
of the report element measured in pixels. Other element stretching
settings may instruct the reporting engine to ignore the specified
element height. Even in this case, the attributes remain mandatory
since even when the height is calculated dynamically, the element will
not be smaller than the originally specified height.
You can read this article for better understanding the mechanism of changing the element size.
If it's genuinely just a couple of fields that come from the same row in the dataset, then you could hack something together.
Use a monospace font
Define your maximum field length with a String set to N spaces. For example:
$P{MaxLengthString} default value is 10 spaces: " "
Change your field text from $F{FirstName} to this:
$P{MaxLengthString}.substring(
$P{MaxLengthString}.length() + $F{FirstName}.length() - java.lang.Math.max($F{FirstName}.length(), $F{LastName}.length())
) + $F{FirstName}
That is... er... a bit more complex. And it only works with monospace fonts. And I can't believe I really suggested this. Don't do it. (But it ought to work.)

How to increase Detail band height dynamically

My requirement is to increase the Detail band height dynamically when the text field has more data. Are there any settings to increase to it? I am using one textField in the Detail band when it has more information (words), it is displaying only some information.
i.e the words are being cut off. Depending on the detail band height the words are displaying. I would like to increase the band height dynamically when the text field has more data.
First select your field and set following properties (third one is most important):
Position type: float
Stretch type: relative to tallest object
Stretch with overflow: true (checked)
Go to Report level properties. Advanced - Set the Column count and then Print order as Horizontal
Try setting the text field and surround object to Position Type Float in the object's properties.
This should let the report expand as the text field grows.