Example usage for com.itextpdf.text.pdf PdfPTable setHeaderRows

List of usage examples for com.itextpdf.text.pdf PdfPTable setHeaderRows

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfPTable setHeaderRows.

Prototype

public void setHeaderRows(int headerRows) 

Source Link

Document

Sets the number of the top rows that constitute the header.

Usage

From source file:others.pdfWriter.java

public static void createTableExercicios(Document document, java.util.List<Exercicios> exercicios)
        throws BadElementException, DocumentException {
    PdfPTable table = new PdfPTable(3);

    // t.setBorderColor(BaseColor.GRAY);
    // t.setPadding(4);
    // t.setSpacing(4);
    // t.setBorderWidth(1);

    PdfPCell c1 = new PdfPCell(new Phrase("Exercicio"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);//from w ww  . jav a  2s . c  o  m

    c1 = new PdfPCell(new Phrase("Descrio"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Musculo"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);
    table.setHeaderRows(1);
    if (exercicios.size() < 1) {
        table.addCell("Adicione Exercicios");
        table.addCell("Adicione Exercicios");
        table.addCell("Adicione Exercicios");
    }
    for (Exercicios exercicio : exercicios) {
        table.addCell(exercicio.getNome());
        table.addCell(exercicio.getDescricao());
        table.addCell(exercicio.getMusculo());
    }

    document.add(table);

}

From source file:others.pdfWriter.java

public static void createTableGeral(Document document, java.util.List<Aluno> alunos)
        throws BadElementException, DocumentException {
    PdfPTable table = new PdfPTable(3);

    // t.setBorderColor(BaseColor.GRAY);
    // t.setPadding(4);
    // t.setSpacing(4);
    // t.setBorderWidth(1);

    PdfPCell c1 = new PdfPCell(new Phrase("Aluno"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);//from   w ww  .j a va  2  s .c  o m

    c1 = new PdfPCell(new Phrase("Email Aluno"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Professor"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);
    table.setHeaderRows(1);
    if (alunos.size() < 1) {
        table.addCell("Nada consta");
        table.addCell("Nada consta");
        table.addCell("Nada consta");
    }
    for (Aluno aluno : alunos) {
        table.addCell(aluno.getNome());
        table.addCell(aluno.getEmail());
        if (aluno.getInstrutor() != null) {
            table.addCell(aluno.getInstrutor().getNome());
        } else {
            table.addCell("Aguarda aceitao");
        }
    }

    document.add(table);

}

From source file:others.pdfWriter.java

public static void createTableAlunos(Document document, java.util.List<Aluno> alunos)
        throws BadElementException, DocumentException {
    PdfPTable table = new PdfPTable(2);

    // t.setBorderColor(BaseColor.GRAY);
    // t.setPadding(4);
    // t.setSpacing(4);
    // t.setBorderWidth(1);

    PdfPCell c1 = new PdfPCell(new Phrase("Aluno"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);//from  w w  w.  j a  va 2s .co m

    c1 = new PdfPCell(new Phrase("Email"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    table.setHeaderRows(1);
    if (alunos.size() < 1) {
        table.addCell("Adicione Alunos");
        table.addCell("Adicione Alunos");
    }
    for (Aluno aluno : alunos) {
        table.addCell(aluno.getNome());
        table.addCell(aluno.getEmail());
    }

    document.add(table);

}

From source file:our.isaacmayur.expensemanager.GenerateReport.java

private static void createTable(Section catPart) throws BadElementException {
    PdfPTable table = new PdfPTable(4);

    // t.setBorderColor(BaseColor.GRAY);
    // t.setPadding(4);
    // t.setSpacing(4);
    // t.setBorderWidth(1);

    for (int i = 0; i < category.size(); i++) {
        Log.e("category...", category.get(i));
        Log.e("mode...", mode.get(i));
        Log.e("amt...", "amt" + amount.get(i));
        Log.e("date2...", "date" + date.get(i));
    }// ww w .j  a v  a2 s  .  c o  m

    PdfPCell c1 = new PdfPCell(new Phrase("Category Name"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Amount Spent (Rs)"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Date"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Payment Mode"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    table.setHeaderRows(1);
    /*
     * table.addCell("pay"); table.addCell("hell"); table.addCell("to");
     * table.addCell("to"); table.addCell("to");
     * 
     * table.addCell("2.1"); table.addCell("2.2"); table.addCell("2.3");
     */
    // code to add rows dynamically...remember the multiple

    for (int i = 0; i < category.size(); i++) {
        table.addCell(category.get(i));
        table.addCell(amount.get(i) + "");
        table.addCell(date.get(i));
        table.addCell(mode.get(i));

    }

    catPart.add(table);
    Log.e("meta", "table");

}

From source file:pdf.PDFdescriptiva.java

private static void tablaPrediccion(Section subCatPart, Double Y, Double li, Double ls)
        throws DocumentException {
    PdfPTable table = new PdfPTable(3);

    PdfPCell c1 = new PdfPCell(new Phrase("Y estimada"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);//from  w ww .java2 s  .  co  m

    c1 = new PdfPCell(new Phrase("Li"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Ls"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    table.setHeaderRows(1);
    table.addCell(Y + "");
    table.addCell(li + "");
    table.addCell(ls + "");
    subCatPart.add(table);

}

From source file:pdf.PDFdescriptiva.java

private static void agregarTabla(Document doc, String titulo, String[][] arreglo) throws DocumentException {
    PdfPTable table = new PdfPTable(9);

    PdfPCell c1 = new PdfPCell(new Phrase("i"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);/*from   w  ww.  j  a  v  a  2  s .c om*/

    c1 = new PdfPCell(new Phrase("Li"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Ls"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Xi"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Fi"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Fa"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Fr"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Fra"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("XiFi"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    table.setHeaderRows(1);
    for (String[] arreglo1 : arreglo) {
        table.addCell(arreglo1[0]);
        table.addCell(arreglo1[1]);
        table.addCell(arreglo1[2]);
        table.addCell(arreglo1[3]);
        table.addCell(arreglo1[4]);
        table.addCell(arreglo1[5]);
        table.addCell(arreglo1[6]);
        table.addCell(arreglo1[7]);
        table.addCell(arreglo1[8]);

    }
    doc.add(table);

}

From source file:pdf.PDFmultiple.java

private static void agregarTabla(Document doc, String titulo, String[][] arreglo) throws DocumentException {
    PdfPTable table = new PdfPTable(9);

    PdfPCell c1 = new PdfPCell(new Phrase("X1"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);//w w  w .ja va  2  s.com

    c1 = new PdfPCell(new Phrase("X2"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Y"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Y estimada"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("X1^2"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("X2^2"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("X1*Y"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("X2*Y"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Y-Y estimada"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    table.setHeaderRows(1);
    for (String[] arreglo1 : arreglo) {
        table.addCell(arreglo1[0]);
        table.addCell(arreglo1[1]);
        table.addCell(arreglo1[2]);
        table.addCell(arreglo1[3]);
        table.addCell(arreglo1[4]);
        table.addCell(arreglo1[5]);
        table.addCell(arreglo1[6]);
        table.addCell(arreglo1[7]);
        table.addCell(arreglo1[8]);
    }
    doc.add(table);

}

From source file:pdf.PDFsimple.java

private static void agregarTabla(Document doc, String titulo, String[][] arreglo) throws DocumentException {
    PdfPTable table = new PdfPTable(6);

    PdfPCell c1 = new PdfPCell(new Phrase("X"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);//from w  w w.  ja v  a2  s  .  com

    c1 = new PdfPCell(new Phrase("Y"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("X*Y"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("X2"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Y2"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Y-ESTIMADA"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    table.setHeaderRows(1);
    for (String[] arreglo1 : arreglo) {
        table.addCell(arreglo1[0]);
        table.addCell(arreglo1[1]);
        table.addCell(arreglo1[2]);
        table.addCell(arreglo1[3]);
        table.addCell(arreglo1[4]);
        table.addCell(arreglo1[5]);
    }
    doc.add(table);

}

From source file:pdf.PDFtexto.java

private static void agregarTabla(Document doc, String titulo, String[][] arreglo) throws DocumentException {
    PdfPTable table = new PdfPTable(2);

    if (titulo.equals("Mineria de Texto")) {
        PdfPCell c1 = new PdfPCell(new Phrase("Palabra"));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(c1);/*from  w w w .j  a  va 2  s.c  o m*/

        c1 = new PdfPCell(new Phrase("Repetido"));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(c1);
        table.setHeaderRows(1);
        for (String[] arreglo1 : arreglo) {
            table.addCell(arreglo1[0]);
            table.addCell(arreglo1[1]);
        }
    }
    doc.add(table);

}

From source file:pdfcreator.Main.java

private static void createTable(Section subCatPart) throws BadElementException {
    PdfPTable table = new PdfPTable(3);

    PdfPCell c1 = new PdfPCell(new Phrase("Table Header 1"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);/*from  ww w  .  j ava  2  s.co m*/

    c1 = new PdfPCell(new Phrase("Table Header 2"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Table Header 3"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);
    table.setHeaderRows(1);

    table.addCell("1.0");
    table.addCell("1.1");
    table.addCell("1.2");
    table.addCell("2.1");
    table.addCell("2.2");
    table.addCell("2.3");

    subCatPart.add(table);

}