Hi List,

  first: I really appreciate the work of Paulo and Bruno, and all the
other active people on this list. Thanx a lot!

But now to the Prob:

 I have to do some formatting on a PdfPTable. I want to align some Text
to the right of its Cell. Therefore I'd like to do something similar to
this:

    Font font = FontFactory.getFont(FontFactory.HELVETICA, 10);
    int fontSize = 8;
    float padding = 3f;

    PdfPTable table = new PdfPTable(1);
    table.setWidthPercentage(100f);
    Paragraph para = new Paragraph(new Chunk("Hello",font));
    para.setAlignment(Paragraph.ALIGN_RIGHT);
    PdfPCell cell = new PdfPCell(para);
    cell.setPadding(padding);
    table.addCell(cell);

This way the Padding is fine, but it's not right-aligned.

If I change the code a bit, it get's 'different':

    Font font = FontFactory.getFont(FontFactory.HELVETICA, 10);
    int fontSize = 8;
    float padding = 3f;

    PdfPTable table = new PdfPTable(1);
    table.setWidthPercentage(100f);
    Paragraph para = new Paragraph(new Chunk("Hello",font));
    para.setAlignment(Paragraph.ALIGN_RIGHT);
--> PdfPCell cell = new PdfPCell();
--> cell.addElement(para);
    cell.setPadding(padding);
    table.addCell(cell);

now the alignment is okay, but the Padding to the top is too big. The
Cell acts, as if there is an empty column above the added Paragraph.

Call me stubborn, I'd like to have proper padding AND desired alignment.
How can I achieve this, without changing too much of my approach?

Many thanks in advance,

        Tim Dylla


PS.: hope the code is correct, I did a dirty copy/paste...









-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to