Hi,

I'm having trouble to line up my table header.  Please take a look at the line 
in gray background in the enclosed attachment.  The number 5, 3, and 1 are 
slightly higher than number 4 and 2.  Each cell of the header is created with a 
call to the following code.  For instance,  getHeaderCell("E 5") would create 
the E over 5 in the picture, while getHeaderCell(" 4") would create the empty 
space over 4.  I've also tried Element.align_bottom. It does line up exactly.

public PdfPCell getHeaderCell(String hdString) {
        PdfPTable table1 = new PdfPTable(1);
        table1.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        table1.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
        table1.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        if (hdString.startsWith(" ") ) table1.addCell(new Phrase(" ", NORMAL));
        String[] words = hdString.split(" ");
        for (int j=0; j<words.length; j++) {
            table1.addCell(new Phrase(words[j], NORMAL));
        }
        PdfPCell hdCell = new PdfPCell(table1);
        return hdCell;
    }

Thanks in advance,
Jiujing

<<attachment: itex.png>>

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to