border of PdfPTable - iText, java - itext

I need to have a border line for the PdfPTable but not for the cells inside. Can anyone tell me how to do it?
I have done this by putting this table inside a new cell. Now my question is how to add a line to split the rows?

In iText each PdfPCell has its own borders.
You can set the borders needed on the cell, and in case of a nested table do the same for that tables cells.
In your case you probably want to set the bottom border on the entire row that is to be separated.

Related

Square table cell in a table view

Instead of having table cells that takes the entire width of the screen, I would like to have square table cell, so that I can have maybe 3 or 4 table cells per line. The table cell would also change its size on the vertical dimension.
Is it possible ?
Thanks !
You should use UICollectionView instead of UITableView.

How to create vertical line in iReport?

I'm using iReport-3.7.4 ,
I want to make table in detail like this ,
but , the line in this table can't longwise until the end of the table,
I've placed this table in detail ..
In iReport, Right Click on a Field, and goto Padding and Borders and set Line width to 1. As shown below:
Put the repetitive things in sub-report and draw the vertical lines in appropriate margins. Load the sub-report in the main window with its width tallies with the parent width. Test & modify the report again an again till you get the lines in the correct places. Moreover make sure you have checked on Print Repeated Values property for the line.
I've attached some reports I've created for my project, hope they can explain you well.
The Parent Report
The Sub-Report
The Final Output
If you really want to draw a line then just drag line element from palette and drag the bottom middle point of that tile element to increase the size and then decrease the width by dragging left middle point.

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.

Setting fixed height for all cells at once in iText 2.0.7

Is there anyway where we can set the height of each cell to a particular height? I created multiple cells using PdfPCell,the height is common to all the cells so I wanted to set the height of each cell at once to shorten my code, currently I am doing it using the PdfPCell's setFixedHeight method.
Retrieve the default PdfPCell and set its fixed height. All the cells of the PdfPTable will have the same height afterwards. This will have to be repeated for each table though.

Cell Separator Style

How can we set Separator style at cell level. i.e. each cell will be having different separator style?
I don't think you can set the cell separator style per cell. You might try setting the table view separator to UITableViewCellSeparatorStyleNone and then draw a custom "separator" yourself when you render out each cell.
Edit: How to do it depends a lot on your current code, what type of table, whether you are using a custom table cell, what exactly you mean by "different separator style", etc.
I have not tried this, but one option I can think of off the top of my head would be to use the UITableViewCell.backgroundView property. You could add a subview with a different color that is only a few pixels high along the bottom or you could create a UIImageView that fills the backgroundView and set the image to achieve the "different" separator.