Hi,

 

When the rowspan is > 1, vertical aligment doesn’t work very well, it doesn’t take into account the needed height of the data.  I don’t understand the vertical aligment of the source code (class com.lowagie.text.pdf.PdfCell)

 

Please can anyone help?

 

I’ve found in the mailing list archives, people like this, that have had the same problem, but I haven’t seen any solution:

 

 

Subject: vertical alignment when using row spanning or items with differentsizes.
From: Fred Romelfanger <
fred <at> stsci.edu
>
Date: Mon, 28 Apr 2003 23:08:23 -0400
Newsgroups:
gmane.comp.java.lib.itext.general

 
I am having a problem with getting vertical alignment to work with
cells in a row being different sizes, or with row spanning.
Basically all I get is something like ALIGN_TOP no matter which one
I use.  Horizontal alignment seems to work fine.  Looking at the source
it appears that vertical alignment only works with the leading and
spacing in the cell, but doesn't take into account the actual height of
the cell.  PdfPTable appears that it would correctly handle the
alignment, but I don't see any way to create a PdfPTable through the
PdfWriter interface.  I also tried spanning rows and get a very similiar
behavior.  I can put in empty cells above the middle and the right cells
and while making the first cell span several rows, and get closer but 
that seems somewhat over complicated.
 
     void makeHeader(Table headerTable, Image im, Phrase headerCenter, 
Phrase headerRight) {
         Cell cell = new Cell(im);
         cell.setVerticalAlignment(cell.ALIGN_BOTTOM);
         cell.setHorizontalAlignment(cell.ALIGN_LEFT);
         headerTable.addCell(cell);
         cell = new Cell(headerCenter);
         cell.setVerticalAlignment(cell.ALIGN_BOTTOM);
         cell.setHorizontalAlignment(cell.ALIGN_CENTER);
         headerTable.addCell(cell);
         cell = new Cell(headerRight);
         cell.setVerticalAlignment(cell.ALIGN_BOTTOM);
         cell.setHorizontalAlignment(cell.ALIGN_RIGHT);
         headerTable.addCell(cell);
     }
 
Also images in cells seem to have extra space at the bottom not in the 
original image.
 
Any suggestions would be helpful.
                              Thanks,
                                 Fred Romelfanger
                                 fred <at> stsci.edu

 

--------

David

 

Reply via email to