[EMAIL PROTECTED] wrote:
> hallo all together
>
> i have a huge problem!
Your huge problem being unable to read the documentation?
> if i m adding paragraphs to a cell the aligment of align_middle isn't working.
You are mixing 'text mode' with 'composite mode' in your code snippet.
The first thing you need to know that a PdfPCell is treated as a
ColumnText object (see chapter 6 and 7 of the book).
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:
[text mode]
Phrase phrase = new Phrase("Hello");
PdfPCell cell = new PdfPCell(phrase);
cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
cell.setPadding(padding);
table.addCell(cell);
or
[composite mode]
PdfPCell cell = new PdfPCell();
Paragraph p = new Paragraph("Hello");
p.setAlignment(Element.ALIGN_RIGHT);
cell.addElement(p);
table.addCell(cell);
Read chapter 6 and 7 of "iText in Action" for more info.
--
This answer is provided by 1T3XT BVBA
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar