I have a PdfPTable and I want the text in the PdfPCells to be truncated
if it doesn't fit in the allotted width for the cell.
I have tried with setNoWrap and setFixedHeight as shown in attached
sample code.
Is there a way to make iText to truncate (clip) the text at the cell
border?
float[] widths = {0.5f, 0.5f};
PdfPTable table = new PdfPTable(widths);
PdfPCell cell = new PdfPCell(new Paragraph("header"));
cell.setColspan(2);
cell.setFixedHeight(50.0f);
table.addCell(cell);
cell = new PdfPCell(new Paragraph("some large text that needs to be
truncated.some large text that needs to be truncated.some large text
that needs to be truncated.some large text that needs to be
truncated.some large text that needs to be truncated."));
cell.setNoWrap(false);
cell.setFixedHeight(50.0f);
table.addCell(cell);
cell = new PdfPCell(new Paragraph("some large text that needs to be
truncated.some large text that needs to be truncated.some large text
that needs to be truncated.some large text that needs to be
truncated.some large text that needs to be truncated."));
cell.setNoWrap(true);
cell.setFixedHeight(50.0f);
table.addCell(cell);
document.add(table);
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/