Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.PdfPTable


   * @throws DocumentException
   * @since 5.0.6
   */
  public void processTable() throws DocumentException{
    TableWrapper table = (TableWrapper) stack.pop();
    PdfPTable tb = table.createTable();
    tb.setSplitRows(true);
    if (stack.empty())
      document.add(tb);
    else
      ((TextElementArray) stack.peek()).add(tb);
  }
View Full Code Here


            / Math.pow(10.0, 2);
        timeRefPercent = Math.round(((timeRefPercent / timeTT) * 100)
            * Math.pow(10.0, 2))
            / Math.pow(10.0, 2);

        PdfPTable table = new PdfPTable(4);

        PdfPCell c1 = new PdfPCell(new Phrase(
            "Temps total effectué (72h)", FontFactory.getFont(
                FontFactory.TIMES_ROMAN, 15,
                com.itextpdf.text.Font.BOLD)));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setPaddingBottom(7);
        table.addCell(c1);
        c1 = new PdfPCell(new Phrase("Temps total validé",
            FontFactory.getFont(FontFactory.TIMES_ROMAN, 15,
                com.itextpdf.text.Font.BOLD)));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setPaddingBottom(7);
        table.addCell(c1);
        c1 = new PdfPCell(new Phrase("Temps total en attente",
            FontFactory.getFont(FontFactory.TIMES_ROMAN, 15,
                com.itextpdf.text.Font.BOLD)));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setPaddingBottom(7);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Temps total refusé",
            FontFactory.getFont(FontFactory.TIMES_ROMAN, 15,
                com.itextpdf.text.Font.BOLD)));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setPaddingBottom(7);
        table.addCell(c1);

        table.setHeaderRows(1);

        c1 = new PdfPCell(new Phrase((timeTT / 60 - (timeTT % 60 / 60))
            + "h " + (timeTT % 60) + "min"));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setPaddingBottom(4);
        table.addCell(c1);
        c1 = new PdfPCell(new Phrase(
            (timeVal / 60 - (timeVal % 60 / 60)) + "h "
                + (timeVal % 60) + "min"));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setPaddingBottom(4);
        table.addCell(c1);
        c1 = new PdfPCell(new Phrase(
            (timeAtt / 60 - (timeAtt % 60 / 60)) + "h "
                + (timeAtt % 60) + "min"));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setPaddingBottom(4);
        table.addCell(c1);
        c1 = new PdfPCell(new Phrase(
            (timeRef / 60 - (timeRef % 60 / 60)) + "h "
                + (timeRef % 60) + "min"));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setPaddingBottom(4);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase(timeTTpercent + "%"));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setPaddingBottom(4);
        table.addCell(c1);
        c1 = new PdfPCell(new Phrase(timeValPercent + "%"));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setPaddingBottom(4);
        table.addCell(c1);
        c1 = new PdfPCell(new Phrase(timeAttPercent + "%"));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setPaddingBottom(4);
        table.addCell(c1);
        c1 = new PdfPCell(new Phrase(timeRefPercent + "%"));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setPaddingBottom(4);
        table.addCell(c1);

        document.add(table);

      } catch (DocumentException de) {
        de.printStackTrace();
View Full Code Here

   // create table
    public static PdfPTable createTable() throws DocumentException {
     

        // create 6 column table
        PdfPTable table = new PdfPTable(6);
       
        // set the width of the table to 100% of page
        table.setWidthPercentage(100);
       
        // set relative columns width
        table.setWidths(new float[]{0.6f, 1.4f, 0.8f,0.8f,1.8f,2.6f});

       
        // ----------------Table Header "Title"----------------
        // font
        Font font = new Font(FontFamily.HELVETICA, 14, Font.BOLD, BaseColor.WHITE);
        // create header cell
        PdfPCell cell = new PdfPCell(new Phrase("HMKCODE.com - iText PDFTable Example",font));
        // set Column span "1 cell = 6 cells width"
        cell.setColspan(6);
        // set style
        Style.headerCellStyle(cell);
        // add to table
        table.addCell(cell);
       
        //-----------------Table Cells Label/Value------------------
       
        // 1st Row
        table.addCell(createLabelCell("Label 1"));
        table.addCell(createValueCell("Value 1"));
        table.addCell(createLabelCell("Label 2"));
        table.addCell(createValueCell("Value 2"));
        table.addCell(createLabelCell("Label 3"));
        table.addCell(createValueCell("Value 3"));

        // 2nd Row
        table.addCell(createLabelCell("Label 4"));
        table.addCell(createValueCell("Value 4"));
        table.addCell(createLabelCell("Label 5"));
        table.addCell(createValueCell("Value 5"));
        table.addCell(createLabelCell("Label 6"));
        table.addCell(createValueCell("Value 6"));

        return table;
    }
View Full Code Here

        document.add(createTable(runStats));
        document.add(createFooter());
    }

    private PdfPTable createTable(final TestRunCoverageStatistics runStats) throws DocumentException {
        final PdfPTable table = new PdfPTable(4);

        table.setSpacingBefore(10);
        table.setSpacingAfter(10);
        table.setWidthPercentage(100);
        table.setHeaderRows(1);
        table.setWidths(new int[] {70, 10, 10, 10});

        addHeader(table);
        addTotalRow(runStats, table);
        addFileStatsRows(runStats, table);
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.