Marc Lustig wrote:
there is another strange behaviour with PdfPCell:
PdfPCell c = new PdfPCell();
c.setBorder(0);
c.setVerticalAlignment(Element.ALIGN_BOTTOM);
c.addElement(new Phrase("Ort:", FONT));
c.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
table.addCell(c);
---> against any expectation the text "Ort" is NOT positioned at the
right border of the cell, it's still at the left border (default).
Why?
The secret is in object ColumnText.
If you create a Cell like this:
PdfPCell c = new PdfPCell(new Phrase("Ort:", FONT));
the content of the cell is stored as a ColumnText object in 'text only mode'
and the properties of the cell are used.
If you create a Cell like this:
PdfPCell c = new PdfPCell();
and you add all kinds of objects with addElement,
the content of the cell is stored as a ColumnText object in 'composite mode'
and the properties of the cell are overruled by the properties of the
content.
A Phrase doesn't have an alignment, so it is positioned at the left.
br,
Bruno
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions