I've been having a problem for very long time.
Whenever I nest tables (Table class) the Cell Padding
and Vertical Alignment of cells do not work. I have
not tried PDFtables as I want to keep the ability to
output HTML documents. I have wrote a little program
to demostrate this. My goal is to get any text I place
off the bottom of the cell. So either Cell Padding or
vertical Alignment is ok with me. If any know a way to
to do this, please let me know.
thanks
--Tony
 

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ByteArrayOutputStream;
import java.awt.Color;
import java.awt.geom.Rectangle2D;
import java.awt.Graphics2D;
import java.util.*;

import com.lowagie.text.*;
//import com.lowagie.text.html.HtmlWriter;
import com.lowagie.text.pdf.*;



public class VAlignTest {
    public VAlignTest() throws Exception {
        Document document = new
Document(PageSize.LETTER, 36, 36, 36, 36);

        try {
            PdfWriter writer =
PdfWriter.getInstance(document, new
FileOutputStream("/tmp/VAlignTest.pdf"));
            document.open();
            Table outerTable = new Table(1);
            Table innerTable = new Table(1,5);
                     
            innerTable.setCellpadding(5);
            
            Cell c1 = new Cell("Row 1");
            Cell c2 = new Cell("Row 2");
            Cell c3 = new Cell("Row 3");
            Cell c4 = new Cell("Row 4");
            Cell c5 = new Cell("Row 5");
            
            c1.setVerticalAlignment(Cell.ALIGN_TOP);
            c2.setVerticalAlignment(Cell.ALIGN_TOP);
            c3.setVerticalAlignment(Cell.ALIGN_TOP);
            c4.setVerticalAlignment(Cell.ALIGN_TOP);
            c5.setVerticalAlignment(Cell.ALIGN_TOP);
            
            innerTable.addCell(c1);
            innerTable.addCell(c2);
            innerTable.addCell(c3);
            innerTable.addCell(c4);
            innerTable.addCell(c5);
            
            outerTable.insertTable(innerTable);
            
            document.add(new Phrase("Inner Table
(Alone)"));
            document.add(innerTable);
            document.add(new Phrase("Outer Table
(Inner Table is nested)"));
            document.add(outerTable);

        } catch(Exception ex) {
            ex.printStackTrace();
        }

        document.close();
    }

    public static void main(String[] args) {
      try {
        new VAlignTest();
      } catch (Exception ex) {
        ex.printStackTrace();
      }
      System.exit(0);
    }
} 


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to