Hi, newbie here trying to create a simple table with
vertical alignment in the cells. The vertical alignment
appears to be doing nothing. Do you see anything wrong
here?

Thanks.
Dean Hoover

import java.io.FileOutputStream;
import java.io.IOException;

import com.lowagie.text.Cell;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Element;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Table;
import com.lowagie.text.pdf.PdfWriter;

/*
 * Created on Oct 26, 2004
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */

/**
 * @author
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class Test {

        public static void main(String[] args) {
                Document document = new Document(PageSize.LETTER.rotate());
                
                
                try {
            
                        // step 2:
                        // we create a writer that listens to the document
                        // and directs a PDF-stream to a file
            
                        PdfWriter.getInstance(document, new FileOutputStream
("Chap0101.pdf"));
            
                        // step 3: we open the document
                        document.open();
                        Table table = new Table(7);
                        Cell cell = new Cell("Level 4");
                        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                        table.addCell(cell);
                        cell = new Cell("TOW");
                        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                        table.addCell(cell);
                        cell = new Cell("Calls Answered");
                        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                        table.addCell(cell);
                        cell = new Cell("% NT Calls");
                        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                        table.addCell(cell);
                        cell = new Cell("Skill");
                        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                        table.addCell(cell);
                        cell = new Cell("NT Calls by Skill xxx xxx xxx xxx xxx 
xxx xxx");
                        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                        table.addCell(cell);
                        cell = new Cell("NT Calls by Skill %");
                        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                        table.addCell(cell);
                        document.add(table);
                }
                catch(DocumentException de) {
                        System.err.println(de.getMessage());
                }
                catch(IOException ioe) {
                        System.err.println(ioe.getMessage());
                }
        
                // step 5: we close the document
                document.close();

        }
}




-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to