JasperReports: set textfield height to height of other element in band - jasper-reports

I have several textfields on a single row in the same band. The first of them is having a larger font than the rest. However, the size of this font might change for each record. How can I set the height of the other textfields to be dependant of the height of the first one?
Thanks for your help,
Andreas

On each field in the row set Stretch Type to be Relative to Tallest Object.

Related

itext -- How do setMinimumSize() and setFixedSize() interact?

Is it well-defined in iText to call setMinimumSize(15) on some cells in a row, and setFixedSize(15) on the other cells of the same row?
What I would like is for iText to increase the row height to accommodate the text in the cells whose minimum height is set, while letting text in cells set to a fixed height clip. Is that what iText does?
If not, how do I achieve this? Thanks.
While we're at it, am I correct that calling neither setMinimumSize() nor setFixedSize() is equivalent to calling setMinimumSize(0) -- iText makes the cell as tall as it needs to be to accommodate the text?
This is with iText 2.1.6.
I already explained in a comment that setFixedHeight() always gets preference. If you use setMinimumHeight() and setFixedHeight() in the same row, and you define a minimum height along with a fixed height, the fixed height prevails.
if the minimum height is set to 30pt and the fixed height is 60pt, the height will be 60pt, no matter how much content is added to the cell.
if the minimum height is set to 60pt and the fixed height is 60pt, the height will be 60pt, no matter how much content is added to the cell.
if the minimum height is set to 120pt and the fixed height is 60pt, the height will be 60pt, no matter how much content is added to the cell.
If different fixed heights are defined, the highest value is taken. For instance: if you have a row where one cell has a fixed height (e.g 120 pt) that is higher than the fixed height of another cell (e.g. 60 pt), then the highest value (in this case 120) prevails.
You claim that this isn't mentioned in the book I wrote. Please note that the book counts about 600 pages. A lot of text I wrote was edited away by the publisher. Otherwise the book would have been a thousand pages and more.
You could have written a small test example, such as the FixedHeightCell example. Please take a look at the resulting PDF. In row D all the cells have a fixed height of 60 pt. In row E, most cells also have a fixed height of 60, but the cell in column 4 has a fixed height of 120, hence the height of the row is 120. Then there's row F, with a fixed height of 60 pt and a minimum height of 120 pt. Although we add text that doesn't fit the cell in column 2, the content is truncated.

CellList: How to set row height dynamically?

I have a CellList which will have fix number cells in one page, i would like the cells extend to fill the whole CellList.
Suppose the CellList height is 100px, the cell number is 10, then one cell/row will be 10px, if the CellList height is 500px, each cell/row's height will be 50px.
The problem is, how to control the row height after table rendered, i tried to addLoadingStateChangeHandler on cell list and when onLoad i use GQuery to resize the cell height, but seems no effect.
Yes i can get each row's height beforehand, but how to apply to the CellList's CSS?
Any ideas on this?
Problem solved, when creating a new cell, specify its height(because we know the height beforehand), when resizing the CellList, just redraw it by specifying a new height.

How to clip the cell in a PdfPTable with iText?

I am creating a one column PdfPTable given a Rectangle, at a particilar absolute position. In this table, I need to add a collection of PdfPCells and show as much of the cell content as possible and the cells must be clipped at the table rectangle boundaries. I took care of the width by:
PdfPTable cutTable = new PdfPTable(1);
cutTable.setTotalWidth(200f);
cutTable.setLockedWidth(true);
I have a phrase object in each cell and I add a set of cells to the table. The problem is that the cells overflows the table height boundary and it is not clipped. I tried keeping track of the total cells' height after adding each cell, but the problem is that since I ask the table for the row height, a cell must be inserted before and my calculation is off as the last cell overflows.
How do I get the table to clip the cell contents at its boundaries? If I can't do this, how do I determine the height of the cell(the phrase uses Arial 8 font) with the default text wrapping, before it is added to the table?
Thanks in advance for your help.
Take a look at the CellHeights example from my book "iText in Action." It uses the different options to set the height of a cell. I think you need the setFixedHeight() method. When using this method, all content added to the cell that doesn't fit the height will be dropped.

How to determine height of a row in UITextView?

The font size of text in a UITextView is dynamic, how can I determine the current height of a row (i.e. sizeWithFont.height + line spacing height)?
You might try:
textView.font.lineHeight
Content size of the UITextView gives the height of the text in textView.
With the frame property you can access properties like height or width.
myTextView.frame.size.heigth;
If you get silly values, use bounds instead of frame.

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.