Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.PdfPTable


    document.newPage();
  }

  private PdfPTable getHeatTable() {
    float[] tableWidth = { 0.07f, 0.45f, 0.28f, 0.20f };
    PdfPTable table = new PdfPTable(tableWidth);

    // add Column titles
    PdfPCell c21 = new PdfPCell(new Phrase("NR", normalHeaderFont));
    c21.setHorizontalAlignment(Element.ALIGN_CENTER);
    c21.setVerticalAlignment(Element.ALIGN_CENTER);
    table.addCell(c21);
    PdfPCell c22 = new PdfPCell(new Phrase("Nume", normalHeaderFont));
    c22.setHorizontalAlignment(Element.ALIGN_CENTER);
    c22.setVerticalAlignment(Element.ALIGN_CENTER);
    table.addCell(c22);
    PdfPCell c23 = new PdfPCell(new Phrase("Club", normalHeaderFont));
    c23.setHorizontalAlignment(Element.ALIGN_CENTER);
    c23.setVerticalAlignment(Element.ALIGN_CENTER);
    table.addCell(c23);
    PdfPCell c24 = new PdfPCell(new Phrase("Timp", normalHeaderFont));
    c24.setHorizontalAlignment(Element.ALIGN_CENTER);
    c24.setVerticalAlignment(Element.ALIGN_CENTER);
    table.addCell(c24);

    // lane 1 cells
    PdfPCell c31 = new PdfPCell(new Phrase(Integer.toString(heat.getLane1().getLaneNumber()), normalFont));
    table.addCell(c31);
    PdfPCell c32 = new PdfPCell(new Phrase(heat.getLane1().getSwimmer().getName(), normalFont));
    table.addCell(c32);
    PdfPCell c33 = new PdfPCell(new Phrase(heat.getLane1().getSwimmer().getClub(), normalFont));
    table.addCell(c33);
    table.addCell(new PdfPCell());

    // lane 2 cells
    PdfPCell c41 = new PdfPCell(new Phrase(Integer.toString(heat.getLane2().getLaneNumber()), normalFont));
    table.addCell(c41);
    PdfPCell c42 = new PdfPCell(new Phrase(heat.getLane2().getSwimmer().getName(), normalFont));
    table.addCell(c42);
    PdfPCell c43 = new PdfPCell(new Phrase(heat.getLane2().getSwimmer().getClub(), normalFont));
    table.addCell(c43);
    table.addCell(new PdfPCell());

    // lane 3 cells
    PdfPCell c51 = new PdfPCell(new Phrase(Integer.toString(heat.getLane3().getLaneNumber()), normalFont));
    table.addCell(c51);
    PdfPCell c52 = new PdfPCell(new Phrase(heat.getLane3().getSwimmer().getName(), normalFont));
    table.addCell(c52);
    PdfPCell c53 = new PdfPCell(new Phrase(heat.getLane3().getSwimmer().getClub(), normalFont));
    table.addCell(c53);
    table.addCell(new PdfPCell());

    // lane 4 cells
    PdfPCell c61 = new PdfPCell(new Phrase(Integer.toString(heat.getLane4().getLaneNumber()), normalFont));
    table.addCell(c61);
    PdfPCell c62 = new PdfPCell(new Phrase(heat.getLane4().getSwimmer().getName(), normalFont));
    table.addCell(c62);
    PdfPCell c63 = new PdfPCell(new Phrase(heat.getLane4().getSwimmer().getClub(), normalFont));
    table.addCell(c63);
    table.addCell(new PdfPCell());

    // lane 5 cells
    PdfPCell c71 = new PdfPCell(new Phrase(Integer.toString(heat.getLane5().getLaneNumber()), normalFont));
    table.addCell(c71);
    PdfPCell c72 = new PdfPCell(new Phrase(heat.getLane5().getSwimmer().getName(), normalFont));
    table.addCell(c72);
    PdfPCell c73 = new PdfPCell(new Phrase(heat.getLane5().getSwimmer().getClub(), normalFont));
    table.addCell(c73);
    table.addCell(new PdfPCell());

    // lane 6 cells
    PdfPCell c81 = new PdfPCell(new Phrase(Integer.toString(heat.getLane6().getLaneNumber()), normalFont));
    table.addCell(c81);
    PdfPCell c82 = new PdfPCell(new Phrase(heat.getLane6().getSwimmer().getName(), normalFont));
    table.addCell(c82);
    PdfPCell c83 = new PdfPCell(new Phrase(heat.getLane6().getSwimmer().getClub(), normalFont));
    table.addCell(c83);
    table.addCell(new PdfPCell());

    if (event.getPoolType().contains("50")) {

      // lane 7 cells
      PdfPCell c91 = new PdfPCell(new Phrase(Integer.toString(heat.getLane7().getLaneNumber()), normalFont));
      table.addCell(c91);
      PdfPCell c92 = new PdfPCell(new Phrase(heat.getLane7().getSwimmer().getName(), normalFont));
      table.addCell(c92);
      PdfPCell c93 = new PdfPCell(new Phrase(heat.getLane7().getSwimmer().getClub(), normalFont));
      table.addCell(c93);
      table.addCell(new PdfPCell());

      // lane 8 cells
      PdfPCell c101 = new PdfPCell(new Phrase(Integer.toString(heat.getLane8().getLaneNumber()), normalFont));
      table.addCell(c101);
      PdfPCell c102 = new PdfPCell(new Phrase(heat.getLane8().getSwimmer().getName(), normalFont));
      table.addCell(c102);
      PdfPCell c103 = new PdfPCell(new Phrase(heat.getLane8().getSwimmer().getClub(), normalFont));
      table.addCell(c103);
      table.addCell(new PdfPCell());
    } // end 50m pool extra lanes

    return table;
  }
View Full Code Here


    Paragraph eventNameParagraph = new Paragraph(event.getName() + " " + requiredGender.toUpperCase(), headerFont2);
    document.add(eventNameParagraph);
    document.add(oneEmptyLine);

    // table
    PdfPTable table = getResultsTable();
    document.add(table);
    /**
     * Table of heats
     */

 
View Full Code Here

    return roman;
  }
 
  private PdfPTable getResultsTable() {
    float[] tableWidth = { 0.04f, 0.26f, 0.21f, 0.12f, 0.14f, 0.12f, 0.04f, 0.06f };
    PdfPTable table = new PdfPTable(tableWidth);

    // get the results and order them after the time
    List<Result> results = operations.returnResults(event, heatGender, requiredGender);

    Collections.sort(results, new ResultComparator());
    // get the age-groups
    AgeGroup ageGroup = new AgeGroup();
    List<String> ageGroups = ageGroup.getAgeGroups();

    int classification = 1;
    long previousResultTime = 999999;
    int loopNr = 1;

    for (String age : ageGroups) {
      if (operations.searchAgeGroupInResult(results, age, requiredGender)) {
        // Age-group
        PdfPCell c11 = new PdfPCell(new Phrase(getRomanAgeGroup(age) + ". " + age, normalHeaderFont));
        c11.setHorizontalAlignment(Element.ALIGN_LEFT);
        disableBorders(c11);
        c11.setColspan(8);
        table.addCell(c11);

        for (Result res : results) {
          if (res.getSwimmer().getAgeGroup().equals(age)) {
            // add the swimmer

            if (loopNr > 1 && previousResultTime == res.getResultTime()) {
              classification--;
            } else {
              classification = loopNr;
            }

            PdfPCell c21 = new PdfPCell(new Phrase(
                res.getPerformanceStatus().equals("OK") ? Integer.toString(classification) : "",
                normalFont));
            c21.setHorizontalAlignment(Element.ALIGN_CENTER);
            disableBorders(c21);
            table.addCell(c21);
            PdfPCell c22 = new PdfPCell(new Phrase(res.getSwimmer().getName(), normalFont));
            disableBorders(c22);
            table.addCell(c22);
            PdfPCell c23 = new PdfPCell(new Phrase(res.getSwimmer().getClub(), normalFont));
            disableBorders(c23);
            table.addCell(c23);
            PdfPCell c24 = new PdfPCell(new Phrase(res.getSwimmer().getBirthYear(), normalFont));
            disableBorders(c24);
            table.addCell(c24);
            PdfPCell c25 = new PdfPCell(new Phrase(res.getPerformanceStatus().equals("OK") ? padLeft(
                Integer.toString(res.getResultMinutes()), 2)
                + ":"
                + padLeft(Integer.toString(res.getResultSecondes()), 2)
                + ","
                + padLeft(Integer.toString(res.getResultMSeconds()), 2) : "-", normalFont));
            disableBorders(c25);
            table.addCell(c25);
            PdfPCell c26 = new PdfPCell(new Phrase(
                calculations.calculateFinaPoints(res.getSwimTimeSeconds(),
                    calculations.getBaseTimeForEvent(event, age, requiredGender)), normalFont));
            disableBorders(c26);
            table.addCell(c26);
            PdfPCell c27 = new PdfPCell(new Phrase(Integer.toString((!res.getPerformanceStatus().equals(
                "OK") ? 0 : calculations.calculateLocalPoints(classification))), normalFont));
            disableBorders(c27);
            table.addCell(c27);
            PdfPCell c28 = new PdfPCell(new Phrase((res.getPerformanceStatus().equals("OK") ? ""
                : res.getPerformanceStatus()), normalFont));
            disableBorders(c28);
            table.addCell(c28);
            classification++;
            loopNr++;
            previousResultTime = res.getResultTime();
          }
        }

        classification = 1;
        previousResultTime = 99999;
        loopNr = 1;

        // add empty line
        PdfPCell c31 = new PdfPCell(new Phrase(" ", normalHeaderFont));
        c31.setHorizontalAlignment(Element.ALIGN_LEFT);
        disableBorders(c31);
        c31.setColspan(8);
        table.addCell(c31);

      }
    }

    return table;
View Full Code Here

    Paragraph eventNameParagraph = new Paragraph(event.getName(), headerFont2);
    document.add(eventNameParagraph);
    document.add(oneEmptyLine);

    // table
    PdfPTable table = getHeatTable();
    document.add(table);
    /**
     * Table of heats
     */

 
View Full Code Here

    document.newPage();
  }

  private PdfPTable getHeatTable() {
    float[] tableWidth = { 0.04f, 0.36f, 0.30f, 0.14f, 0.16f };
    PdfPTable table = new PdfPTable(tableWidth);

    // add Column titles
    PdfPCell c21 = new PdfPCell(new Phrase("Nr", normalHeaderFont));
    c21.setHorizontalAlignment(Element.ALIGN_CENTER);
    disableBorders(c21);
    table.addCell(c21);
    PdfPCell c22 = new PdfPCell(new Phrase("Nume", normalHeaderFont));
    c21.setHorizontalAlignment(Element.ALIGN_CENTER);
    disableBorders(c22);
    table.addCell(c22);
    PdfPCell c23 = new PdfPCell(new Phrase("Club", normalHeaderFont));
    c21.setHorizontalAlignment(Element.ALIGN_CENTER);
    disableBorders(c23);
    table.addCell(c23);
    PdfPCell c24 = new PdfPCell(new Phrase("Categorie", normalHeaderFont));
    c21.setHorizontalAlignment(Element.ALIGN_CENTER);
    disableBorders(c24);
    table.addCell(c24);
    PdfPCell c25 = new PdfPCell(new Phrase("Timp", normalHeaderFont));
    c21.setHorizontalAlignment(Element.ALIGN_RIGHT);
    disableBorders(c25);
    table.addCell(c25);

    for (Heat heats : heatList) {
      // heat number cell
      PdfPCell c11 = new PdfPCell(new Phrase("Seria " + heats.getHeatNumber(), normalHeaderFont));
      c11.setHorizontalAlignment(Element.ALIGN_CENTER);
      disableBorders(c11);
      c11.setColspan(5);
      table.addCell(c11);

      // lane 1 cells
      PdfPCell c31 = new PdfPCell(new Phrase(Integer.toString(heats.getLane1().getLaneNumber()), normalFont));
      c31.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c31);
      table.addCell(c31);
      PdfPCell c32 = new PdfPCell(new Phrase(heats.getLane1().getSwimmer().getName(), normalFont));
      c32.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c32);
      table.addCell(c32);
      PdfPCell c33 = new PdfPCell(new Phrase(heats.getLane1().getSwimmer().getClub(), normalFont));
      c33.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c33);
      table.addCell(c33);
      PdfPCell c34 = new PdfPCell(new Phrase(heats.getLane1().getSwimmer().getAgeGroup(), normalFont));
      c34.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c34);
      table.addCell(c34);
      PdfPCell c35;
      try {
        c35 = new PdfPCell(new Phrase(padLeft(Integer.toString(heats.getLane1().getEntryMinutes()), 2) + ":"
            + padLeft(Integer.toString(heats.getLane1().getEntrySecondes()), 2) + ","
            + padLeft(Integer.toString(heats.getLane1().getEntryMSeconds()), 2), normalFont));
      } catch (NullPointerException e) {
        c35 = new PdfPCell(new Phrase(""));
      }
      c35.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c35);
      table.addCell(c35);

      // lane 2 cells
      PdfPCell c41 = new PdfPCell(new Phrase(Integer.toString(heats.getLane2().getLaneNumber()), normalFont));
      c41.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c41);
      table.addCell(c41);
      PdfPCell c42 = new PdfPCell(new Phrase(heats.getLane2().getSwimmer().getName(), normalFont));
      c42.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c42);
      table.addCell(c42);
      PdfPCell c43 = new PdfPCell(new Phrase(heats.getLane2().getSwimmer().getClub(), normalFont));
      c43.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c43);
      table.addCell(c43);
      PdfPCell c44 = new PdfPCell(new Phrase(heats.getLane2().getSwimmer().getAgeGroup(), normalFont));
      c44.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c44);
      table.addCell(c44);
      PdfPCell c45;
      try {
        c45 = new PdfPCell(new Phrase(padLeft(Integer.toString(heats.getLane2().getEntryMinutes()), 2) + ":"
            + padLeft(Integer.toString(heats.getLane2().getEntrySecondes()), 2) + ","
            + padLeft(Integer.toString(heats.getLane2().getEntryMSeconds()), 2), normalFont));
      } catch (NullPointerException e) {
        c45 = new PdfPCell(new Phrase(""));
      }
      c45.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c45);
      table.addCell(c45);

      // lane 3 cells
      PdfPCell c51 = new PdfPCell(new Phrase(Integer.toString(heats.getLane3().getLaneNumber()), normalFont));
      c51.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c51);
      table.addCell(c51);
      PdfPCell c52 = new PdfPCell(new Phrase(heats.getLane3().getSwimmer().getName(), normalFont));
      c52.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c52);
      table.addCell(c52);
      PdfPCell c53 = new PdfPCell(new Phrase(heats.getLane3().getSwimmer().getClub(), normalFont));
      c53.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c53);
      table.addCell(c53);
      PdfPCell c54 = new PdfPCell(new Phrase(heats.getLane3().getSwimmer().getAgeGroup(), normalFont));
      c54.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c54);
      table.addCell(c54);
      PdfPCell c55;
      try {
        c55 = new PdfPCell(new Phrase(padLeft(Integer.toString(heats.getLane3().getEntryMinutes()), 2) + ":"
            + padLeft(Integer.toString(heats.getLane3().getEntrySecondes()), 2) + ","
            + padLeft(Integer.toString(heats.getLane3().getEntryMSeconds()), 2), normalFont));
      } catch (NullPointerException e) {
        c55 = new PdfPCell(new Phrase(""));
      }
      c55.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c55);
      table.addCell(c55);

      // lane 4 cells
      PdfPCell c61 = new PdfPCell(new Phrase(Integer.toString(heats.getLane4().getLaneNumber()), normalFont));
      c61.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c61);
      table.addCell(c61);
      PdfPCell c62 = new PdfPCell(new Phrase(heats.getLane4().getSwimmer().getName(), normalFont));
      c62.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c62);
      table.addCell(c62);
      PdfPCell c63 = new PdfPCell(new Phrase(heats.getLane4().getSwimmer().getClub(), normalFont));
      c63.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c63);
      table.addCell(c63);
      PdfPCell c64 = new PdfPCell(new Phrase(heats.getLane4().getSwimmer().getAgeGroup(), normalFont));
      c64.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c64);
      table.addCell(c64);
      PdfPCell c65;
      try {
        c65 = new PdfPCell(new Phrase(padLeft(Integer.toString(heats.getLane4().getEntryMinutes()), 2) + ":"
            + padLeft(Integer.toString(heats.getLane4().getEntrySecondes()), 2) + ","
            + padLeft(Integer.toString(heats.getLane4().getEntryMSeconds()), 2), normalFont));
      } catch (NullPointerException e) {
        c65 = new PdfPCell(new Phrase(""));
      }
      c65.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c65);
      table.addCell(c65);

      // lane 5 cells
      PdfPCell c71 = new PdfPCell(new Phrase(Integer.toString(heats.getLane5().getLaneNumber()), normalFont));
      c71.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c71);
      table.addCell(c71);
      PdfPCell c72 = new PdfPCell(new Phrase(heats.getLane5().getSwimmer().getName(), normalFont));
      c72.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c72);
      table.addCell(c72);
      PdfPCell c73 = new PdfPCell(new Phrase(heats.getLane5().getSwimmer().getClub(), normalFont));
      c73.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c73);
      table.addCell(c73);
      PdfPCell c74 = new PdfPCell(new Phrase(heats.getLane5().getSwimmer().getAgeGroup(), normalFont));
      c74.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c74);
      table.addCell(c74);
      PdfPCell c75;
      try {
        c75 = new PdfPCell(new Phrase(padLeft(Integer.toString(heats.getLane5().getEntryMinutes()), 2) + ":"
            + padLeft(Integer.toString(heats.getLane5().getEntrySecondes()), 2) + ","
            + padLeft(Integer.toString(heats.getLane5().getEntryMSeconds()), 2), normalFont));
      } catch (NullPointerException e) {
        c75 = new PdfPCell(new Phrase(""));
      }
      c75.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c75);
      table.addCell(c75);

      // lane 6 cells
      PdfPCell c81 = new PdfPCell(new Phrase(Integer.toString(heats.getLane6().getLaneNumber()), normalFont));
      c81.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c81);
      table.addCell(c81);
      PdfPCell c82 = new PdfPCell(new Phrase(heats.getLane6().getSwimmer().getName(), normalFont));
      c82.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c82);
      table.addCell(c82);
      PdfPCell c83 = new PdfPCell(new Phrase(heats.getLane6().getSwimmer().getClub(), normalFont));
      c83.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c83);
      table.addCell(c83);
      PdfPCell c84 = new PdfPCell(new Phrase(heats.getLane6().getSwimmer().getAgeGroup(), normalFont));
      c84.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c84);
      table.addCell(c84);
      PdfPCell c85;
      try {
        c85 = new PdfPCell(new Phrase(padLeft(Integer.toString(heats.getLane6().getEntryMinutes()), 2) + ":"
            + padLeft(Integer.toString(heats.getLane6().getEntrySecondes()), 2) + ","
            + padLeft(Integer.toString(heats.getLane6().getEntryMSeconds()), 2), normalFont));
      } catch (NullPointerException e) {
        c85 = new PdfPCell(new Phrase());
      }
      c85.setHorizontalAlignment(Element.ALIGN_LEFT);
      disableBorders(c85);
      table.addCell(c85);

      if (event.getPoolType().contains("50")) {

        // lane 7 cells
        PdfPCell c91 = new PdfPCell(new Phrase(Integer.toString(heats.getLane7().getLaneNumber()), normalFont));
        c91.setHorizontalAlignment(Element.ALIGN_LEFT);
        disableBorders(c91);
        table.addCell(c91);
        PdfPCell c92 = new PdfPCell(new Phrase(heats.getLane7().getSwimmer().getName(), normalFont));
        c92.setHorizontalAlignment(Element.ALIGN_LEFT);
        disableBorders(c92);
        table.addCell(c92);
        PdfPCell c93 = new PdfPCell(new Phrase(heats.getLane7().getSwimmer().getClub(), normalFont));
        c93.setHorizontalAlignment(Element.ALIGN_LEFT);
        disableBorders(c93);
        table.addCell(c93);
        PdfPCell c94 = new PdfPCell(new Phrase(heats.getLane7().getSwimmer().getAgeGroup(), normalFont));
        c94.setHorizontalAlignment(Element.ALIGN_LEFT);
        disableBorders(c94);
        table.addCell(c94);
        PdfPCell c95;
        try {
          c95 = new PdfPCell(new Phrase(padLeft(Integer.toString(heats.getLane7().getEntryMinutes()), 2)
              + ":" + padLeft(Integer.toString(heats.getLane7().getEntrySecondes()), 2) + ","
              + padLeft(Integer.toString(heats.getLane7().getEntryMSeconds()), 2), normalFont));
          c95.setHorizontalAlignment(Element.ALIGN_LEFT);
        } catch (NullPointerException e) {
          c95 = new PdfPCell(new Phrase(""));
        }
        disableBorders(c95);
        table.addCell(c95);

        // lane 8 cells
        PdfPCell c10_1 = new PdfPCell(
            new Phrase(Integer.toString(heats.getLane8().getLaneNumber()), normalFont));
        c10_1.setHorizontalAlignment(Element.ALIGN_LEFT);
        disableBorders(c10_1);
        table.addCell(c10_1);
        PdfPCell c10_2 = new PdfPCell(new Phrase(heats.getLane8().getSwimmer().getName(), normalFont));
        c10_2.setHorizontalAlignment(Element.ALIGN_LEFT);
        disableBorders(c10_2);
        table.addCell(c10_2);
        PdfPCell c10_3 = new PdfPCell(new Phrase(heats.getLane8().getSwimmer().getClub(), normalFont));
        c10_3.setHorizontalAlignment(Element.ALIGN_LEFT);
        disableBorders(c10_3);
        table.addCell(c10_3);
        PdfPCell c10_4 = new PdfPCell(new Phrase(heats.getLane8().getSwimmer().getAgeGroup(), normalFont));
        c10_4.setHorizontalAlignment(Element.ALIGN_LEFT);
        disableBorders(c10_4);
        table.addCell(c10_4);
        PdfPCell c10_5;
        try {
          c10_5 = new PdfPCell(new Phrase(padLeft(Integer.toString(heats.getLane8().getEntryMinutes()), 2)
              + ":" + padLeft(Integer.toString(heats.getLane8().getEntrySecondes()), 2) + ","
              + padLeft(Integer.toString(heats.getLane8().getEntryMSeconds()), 2), normalFont));
        } catch (NullPointerException e) {
          c10_5 = new PdfPCell(new Phrase(""));
        }
        c10_5.setHorizontalAlignment(Element.ALIGN_LEFT);
        disableBorders(c10_5);
        table.addCell(c10_5);
      } // end 50m pool extra lanes

      // add empty line after each heat
      PdfPCell c11_1 = new PdfPCell(new Phrase(" "));
      c11_1.setHorizontalAlignment(Element.ALIGN_CENTER);
      disableBorders(c11_1);
      table.addCell(c11_1);
      PdfPCell c11_2 = new PdfPCell(new Phrase(" "));
      disableBorders(c11_2);
      table.addCell(c11_2);
      PdfPCell c11_3 = new PdfPCell(new Phrase(" "));
      disableBorders(c11_3);
      table.addCell(c11_3);
      PdfPCell c11_4 = new PdfPCell(new Phrase(" "));
      disableBorders(c11_4);
      table.addCell(c11_4);
      PdfPCell c11_5 = new PdfPCell(new Phrase(" "));
      disableBorders(c11_5);
      table.addCell(c11_5);

    }

    return table;
  }
View Full Code Here

        return rows;
    }

    public PdfPTable buildTable() {
        if (rows.isEmpty())
            return new PdfPTable(1);
        int ncol = 0;
        for (PdfPCell pc : rows.get(0)) {
            ncol += pc.getColspan();
        }
        PdfPTable table = new PdfPTable(ncol);
        String width = props.get("width");
        if (width == null)
            table.setWidthPercentage(100);
        else {
            if (width.endsWith("%"))
                table.setWidthPercentage(Float.parseFloat(width.substring(0, width.length() - 1)));
            else {
                table.setTotalWidth(Float.parseFloat(width));
                table.setLockedWidth(true);
            }
        }
        for (ArrayList<PdfPCell> col : rows) {
            for (PdfPCell pc : col) {
                table.addCell(pc);
            }
        }
        return table;
    }
View Full Code Here

      if (tag.equals("table")) {
        if (pendingTR)
          endElement("tr");
        cprops.removeChain("table");
        IncTable table = (IncTable) stack.pop();
        PdfPTable tb = table.buildTable();
        tb.setSplitRows(true);
        if (stack.empty())
          document.add(tb);
        else
          ((TextElementArray) stack.peek()).add(tb);
        boolean state[] = tableState.pop();
View Full Code Here

         */
        @Override
        public void onEndPage(PdfWriter writer, Document document)
        {
            /** The headertable. */
            PdfPTable table = new PdfPTable(2);
            /** A template that will hold the total number of pages. */
            PdfTemplate tpl = writer.getDirectContent().createTemplate(100, 100);
            /** The font that will be used. */
            BaseFont helv = null;
            try
            {
                helv = BaseFont.createFont("Helvetica", BaseFont.WINANSI, false);
            }
            catch (DocumentException e)
            {
            }
            catch (IOException e)
            {
            }
            PdfContentByte cb = writer.getDirectContent();
            // cb.saveState();
            // write the headertable
            table.setTotalWidth(document.right() - document.left());
            table.writeSelectedRows(0, -1, document.left(), document.getPageSize().getHeight() - 50, cb);
            // compose the footer
            String text = "Page " + writer.getPageNumber();
            float textSize = helv.getWidthPoint(text, 12);
            float textBase = document.bottom() - 20;
            cb.beginText();
View Full Code Here

    /**
     * Initialize the main info holder table.
     */
    protected void initTable()
    {
        tablePDF = new PdfPTable(this.model.getNumberOfColumns());
        tablePDF.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
        tablePDF.setWidthPercentage(100);

        smallFont = FontFactory.getFont(FontFactory.HELVETICA, 7, Font.NORMAL, new BaseColor(0, 0, 0));

View Full Code Here

        try
        {
            Document document = new Document(PageSize.A4.rotate(), 60, 60, 40, 40);
            this.initItextWriter(document, out);
            document.open();
            PdfPTable table = new PdfPTable(this.model.getNumberOfColumns());
            ItextTableWriter writer = new ItextTableWriter(table, document);
            writer.writeTable(this.model, "-1");
            document.add(table);
            document.close();
        }
View Full Code Here

TOP

Related Classes of com.itextpdf.text.pdf.PdfPTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.