Hi,

I use iText (jdk1.1 version) to generate PDF on the fly by servlets.
I have problem with vertical alignement of text in cell.

This is an simplified extract of my real code :

Table table = new Table(1, LignesNumber);
Color backColor;
...
for(i=0; i<LignesNumber; i++)
{
  Cell c=new Cell(new Chunk((String)aVectorOfString.elementAt(i), aFont));
  if(ligne % 5 == 0)
  {
    backColor = java.awt.Color.lightGray;
  }
  else
  {
    backColor = java.awt.Color.white;
  }
  c.setBackgroundColor(backColor);
  c.setLeading(7);
  table.addCell(c);
}

This code generates well cells contening my text, but for each cell, the text is a 
little too much on the bottom of the cell.

It looks like this : "  My_text  "
All letters of "my_text" are in the lightGray cell, but the character '_' is one pixel 
below the bottom limit of the lightGray cell, so I see the '_' on white background( 
the background of the next cell).

How can I rise the text in cells ?
In fact, I do not want to change the height of the cells (which is good), but I want 
to vertical align the text in center of cells.

I have tried :
- c.setVerticalAlignement(Element.ALIGN_MIDDLE) and Element.ALIGN_TOP  it does not work
- table.cellSpacing() table.cellSpading(), it does not what I want
- Chunk.setTextRise() does not exist in my iText version


Thanks in advance for your help

kind regards,
Philippe



_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to