用iText 的Table 與Cell 生一個表格...
大概如下"
4行5列  **********************************
*    *      *      *       *     *
********************       *     *
*                  *       *     *
****************************     *
*                          *     *
****************************     *
*                          *     *
**********************************
部分代碼如下:Table table = new Table(5);
 
 table.setBorderWidth(1);
 table.setBorderColor(new Color(0, 0, 255));
 table.setPadding(2);
 table.setSpacing(2);

 table.addCell("1");
 table.addCell("2");
 table.addCell("3");
 
 Cell c = new Cell("4");
 c.setRowspan(2);
 table.addCell(c);
 
   c = new Cell("5");
 c.setRowspan(4);
 table.addCell(c);
 
 
 c = new Cell("6");
 c.setColspan(3);
 table.addCell(c);  
 c = new Cell("7");
 c.setColspan(4);
 table.addCell(c);
 
 c = new Cell("8");
 c.setColspan(4);
 table.addCell(c);錯誤:
DocumentException: java.lang.IndexOutOfBoundsException: Index: 3, Size: 1
at java.util.ArrayList.add(ArrayList.java:368)
at com.lowagie.text.pdf.PdfDocument.extractRows(Unknown Source)
at com.lowagie.text.pdf.PdfDocument.add(Unknown Source)
at com.lowagie.text.pdf.PdfDocument.add(Unknown Source)
at com.lowagie.text.Document.add(Unknown Source)
at Test.main(Test.java:528)