When setting the options testTable.setLastHeaderRow(0);
testTable.setTableFitsPage(true); the table gets started on a new page with
the header row printed twice. Has anyone else had this problem? Any fix?

Sample code

package mil.deca.test;

//java classes
import java.util.*;
import java.io.*;
import java.awt.Color;


import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
import com.lowagie.text.html.*;
import java.awt.Point;

public class test2 {

  public test2() {
  }
  public static void main(String[] args) {
    test2 test21 = new test2();
    Document document = new Document(PageSize.LETTER.rotate());
    try {
      PdfWriter.getInstance(document, new
FileOutputStream("C:\\temp\\file.pdf"));
      HtmlWriter.getInstance(document, new
FileOutputStream("C:\\temp\\file.html"));
    } catch ( Exception e ) {
      return ;
    }
    HeaderFooter footer = new HeaderFooter(new Phrase("Page: "), true);
    footer.setBorder(Rectangle.NO_BORDER);
    document.setFooter(footer);
    Phrase hdr = new Phrase("Table Test " +
                 new java.util.Date());
    HeaderFooter header = new HeaderFooter(hdr, false);
    header.setAlignment(Element.ALIGN_CENTER);
    document.setHeader(header);
    document.open();
    try {
    Table testTable1 = new Table(2);
    testTable1.addCell("Cell0/0"  , new Point(0,0));
    testTable1.addCell("Cell0/1", new Point(0,1));
    document.add(testTable1);
    Table testTable = new Table(2);
    testTable.setCellsFitPage(true);
    testTable.setAlignment(Table.ALIGN_LEFT);
    testTable.setSpaceInsideCell(2);
    testTable.setDefaultVerticalAlignment(Table.ALIGN_MIDDLE);
    testTable.setDefaultHorizontalAlignment(Table.ALIGN_CENTER);
    testTable.setAutoFillEmptyCells(true);
    testTable.setLastHeaderRow(0);
//    testTable.setTableFitsPage(true);
    testTable.addCell("HEADER1"  , new Point(0,0));
    testTable.addCell("HEADER2", new Point(0,1));
    for ( int i = 1; i < 200 ; i++ ) {
        testTable.addCell("Cell" + i , new Point(i,0));
        testTable.addCell(Integer.toString(i), new Point(i,1));

    }
    document.add(testTable);
    } catch ( Exception e ) {
      e.printStackTrace();
    }
    document.close();
  }
}

Scott Tinsley
System Administrator
Defense Commissary Agency
804-734-8857



-------------------------------------------------------
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