bruno schrieb: > > The first thing you need to know that a PdfPCell is treated as a > ColumnText object. > There are two ways to add content to a ColumnText object: > - in text mode > - in composite mode > When you add objects in text mode, the alignment of the object is ignored. > You have to set the alignment at the ColumnText/PdfPCell level. > When you add objects in composite mode, the alignment of the objects is > preserved, but you may loose ColumnText/PdfPCell properties. > > To solve your problem, use: > PdfPTable table = new PdfPTable(1); > table.setWidthPercentage(100f); > Phrase phrase = new Phrase(new Chunk("Hello",font)); > PdfPCell cell = new PdfPCell(phrase); > cell.setHorizontalAlignment(Element.ALIGN_RIGHT); > cell.setPadding(padding); > table.addCell(cell); > > HTH, > Bruno >
Great, many thanks! Now it's clear, I'm not as stubborn as I'm blind: I already tried the cell-alignment, but I must have done something wrong, at least it didn't seem to work. Now everything's fine! A little question in the end: I remember reading in the iText-Tutorial, that the class 'Phrase' is a bit 'quirky', and more often a 'Paragraph' is the better solution. In your example you use the Phrase rather than the Paragraph - is there a special reason? Best, Tim
begin:vcard fn:Tim Dylla n:Dylla;Tim adr:;;Lindenallee 3;Berlin;;13088;Germany tel;work:030 / 64 95 8228 tel;home:030 / 64 95 80 69 tel;cell:0172 / 860 66 72 x-mozilla-html:FALSE version:2.1 end:vcard