Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.PdfPTable


    // Create data paragraph.
    if (birthday.length() + deathday.length() + birthplace.length() + deathplace.length() > 0) {
      Paragraph paragraph = new Paragraph();
      // paragraph.add(new Chunk("\r\n"));
      PdfPTable table = createKeyValuePdfTable();
      addSingleDataLine(table, "Geburtstag", birthday, true, Statics.niceShortDate(birthday));
      if (viewPersonDetails) {
        addSingleDataLine(table, "Geboren in", birthplace, false, null);
      }
      addSingleDataLine(table, "Todestag", deathday, false, Statics.niceShortDate(deathday));
      if (viewPersonDetails) {
        addSingleDataLine(table, "Gestorben in", deathplace, false, null);
      }
      paragraph.add(table);
      document.add(paragraph);
    }

    // Add additional data.
    String job = person.getValueView(Person.JOB).trim();

    if (viewPersonDetails) {
      if (job.length() > 0) {
        Paragraph paragraph = new Paragraph();
        // paragraph.add(new Chunk("\r\n"));
        PdfPTable table = createKeyValuePdfTable();
        addSingleDataLine(table, "Beruf", job, false, null);
        paragraph.add(table);
        document.add(paragraph);
      }
    }
View Full Code Here


  /**
   * Erzeugt f�r die PDF-Datei eine Tabelle mit zwei Spalten.
   */
  private PdfPTable createKeyValuePdfTable() throws DocumentException {
    PdfPTable table = new PdfPTable(new float[] {1f, 2f});
    table.setWidthPercentage(100);
    table.getDefaultCell().setPaddingLeft(0);
    table.getDefaultCell().setBorderWidth(0);
    table.setHorizontalAlignment(Element.ALIGN_LEFT);
    table.setWidths(new int[] {16, 100 - 16});
    table.addCell(new Phrase(" "));
    table.addCell(new Phrase(" "));
    return table;
  }
View Full Code Here

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

     * @return  a PdfPTable
     */
    public PdfPTable createTable() {
      // no rows = simplest table possible
        if (rows.isEmpty())
            return new PdfPTable(1);
        // how many columns?
        int ncol = 0;
        for (PdfPCell pc : rows.get(0)) {
            ncol += pc.getColspan();
        }
        PdfPTable table = new PdfPTable(ncol);
        // table width
        String width = styles.get(HtmlTags.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);
            }
        }
        // horizontal alignment
        String alignment = styles.get(HtmlTags.ALIGN);
        int align = Element.ALIGN_LEFT;
        if (alignment != null) {
          align = HtmlUtilities.alignmentValue(alignment);
        }
        table.setHorizontalAlignment(align);
        // column widths
    try {
      if (colWidths != null)
        table.setWidths(colWidths);
    } catch (Exception e) {
      // fail silently
    }
    // add the cells
        for (List<PdfPCell> col : rows) {
            for (PdfPCell pc : col) {
                table.addCell(pc);
            }
        }
        return table;
    }
View Full Code Here

        newLine(document);

        /**
         * Personal Details
         */
        PdfPTable table = new PdfPTable(2); // 2 columns.

        ArrayList<PdfPCell> cellList = new ArrayList<PdfPCell>();
        cellList.add(new PdfPCell(new Phrase("Staff ID:")));
        cellList.add(new PdfPCell(new Phrase(this.profileRef.getStaffid())));
        cellList.add(new PdfPCell(new Phrase("Title:")));
        cellList.add(new PdfPCell(new Phrase(this.profileRef.getTitle())));
        cellList.add(new PdfPCell(new Phrase("Surname:")));
        cellList.add(new PdfPCell(new Phrase(this.profileRef.getFamilyname())));
        cellList.add(new PdfPCell(new Phrase("First Name:")));
        cellList.add(new PdfPCell(new Phrase(this.profileRef.getFirstname())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Travel Details
         */
        table = new PdfPTable(2);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Travel", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Application Name:")));
        cellList.add(new PdfPCell(new Phrase(this.appRef.getDescription())));
        cellList.add(new PdfPCell(new Phrase("Date of Initial Departure:")));
        cellList.add(new PdfPCell(new Phrase(df.format(this.travelRef.getDatedeparture()))));

        cellList.add(new PdfPCell(new Phrase("Date of Final Return:")));
        cellList.add(new PdfPCell(new Phrase(df.format(this.travelRef.getDatereturn()))));

        cellList.add(new PdfPCell(new Phrase("Purpose of Travel:")));
        cellList.add(new PdfPCell(new Phrase(this.travelRef.getDescription())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }

        document.add(table);

        /**
         * Itinerary Details
         */
        table = new PdfPTable(4);
        table.setWidthPercentage(90f);
        table.setHeaderRows(1);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Itinerary", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Destination", bold)));
        cellList.add(new PdfPCell(new Phrase("Leave Type", bold)));
        cellList.add(new PdfPCell(new Phrase("Travel Day/ Work Day", bold)));


        for (Itinerary i : hops) {
            //cellList.add(new PdfPCell(new Phrase(df.format(i.getDate()))));
            cellList.add(new PdfPCell(new Phrase("BLANK")));
            cellList.add(new PdfPCell(new Phrase(i.getDestinationCity())));
            cellList.add(new PdfPCell(new Phrase(i.getLeavetype())));
            cellList.add(new PdfPCell(new Phrase(i.getTravelday())));
        }

        for (int i = 0; i < cellList.size(); i++) {
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Quote CostCenter
         */
        table = new PdfPTable(2);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Quotes", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Cost Center:")));
        cellList.add(new PdfPCell(new Phrase(this.quoteRef.getCostcenter())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }

        document.add(table);

        /**
         * Flight Quotes
         */
        table = new PdfPTable(4);
        table.setWidthPercentage(90f);
        table.setHeaderRows(1);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Flight Quotes", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("From", bold)));
        cellList.add(new PdfPCell(new Phrase("To", bold)));
        cellList.add(new PdfPCell(new Phrase("Airline", bold)));
        cellList.add(new PdfPCell(new Phrase("Cost Quoted", bold)));


        Flightquotes f = selectedFlgQte;
        cellList.add(new PdfPCell(new Phrase(f.getFlightfromCity())));
        cellList.add(new PdfPCell(new Phrase(f.getFlighttoCity())));
        cellList.add(new PdfPCell(new Phrase(f.getQuotesource())));
        cellList.add(new PdfPCell(new Phrase(f.getCurrency() + " " + f.getQuotecost().toString())));

        for (int i = 0; i < cellList.size(); i++) {
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Car Quotes
         */
        table = new PdfPTable(4);
        table.setWidthPercentage(90f);
        table.setHeaderRows(1);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Flight Quotes", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Collect Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Return Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Rental Company", bold)));
        cellList.add(new PdfPCell(new Phrase("Cost Quoted", bold)));


        Carquotes c = selectedCarQte;
        cellList.add(new PdfPCell(new Phrase(df.format(c.getDatecollect()))));
        cellList.add(new PdfPCell(new Phrase(df.format(c.getDatereturn()))));
        cellList.add(new PdfPCell(new Phrase(c.getProvider())));
        cellList.add(new PdfPCell(new Phrase(c.getCurrency() + " " + c.getQuotecost().toString())));

        for (int i = 0; i < cellList.size(); i++) {
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Accommodation Quotes
         */
        table = new PdfPTable(5);
        table.setWidthPercentage(90f);
        table.setHeaderRows(1);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Accomodation Quotes", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Location", bold)));
        cellList.add(new PdfPCell(new Phrase("Checkin Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Checkout Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Hotel", bold)));
        cellList.add(new PdfPCell(new Phrase("Cost Quoted", bold)));


        Accomodationquotes a = selectedAccQte;
        cellList.add(new PdfPCell(new Phrase(a.getCity())));
        cellList.add(new PdfPCell(new Phrase(df.format(a.getDatecheckin()))));
        cellList.add(new PdfPCell(new Phrase(df.format(a.getDatecheckout()))));
        cellList.add(new PdfPCell(new Phrase(a.getAccomodationprovider())));
        cellList.add(new PdfPCell(new Phrase(a.getCurrency() + " " + a.getQuotecost().toString())));

        for (int i = 0; i < cellList.size(); i++) {
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Approval Section
         */
        newLine(document);
        table = new PdfPTable(2);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Approval", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Approved:")));
        cellList.add(new PdfPCell(new Phrase(this.getApproved() == 1 ? "YES" : "NO")));
        cellList.add(new PdfPCell(new Phrase("Authorizer Name:")));
        cellList.add(new PdfPCell(new Phrase(this.getApprovalName())));

        cellList.add(new PdfPCell(new Phrase("Authorizer Comments:")));
        cellList.add(new PdfPCell(new Phrase(this.getApprovalComment())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }

        document.add(table);

    }
View Full Code Here

        newLine(document);

        /**
         * Personal Details
         */
        PdfPTable table = new PdfPTable(2); // 2 columns.

        ArrayList<PdfPCell> cellList = new ArrayList<PdfPCell>();
        cellList.add(new PdfPCell(new Phrase("Passenger (Full Name):")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getFamilyname() + " " + this.travelerP.getFirstname())));
        cellList.add(new PdfPCell(new Phrase("Home Address Line 1:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getHomeaddress1())));
        cellList.add(new PdfPCell(new Phrase("Home Address Line 2:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getHomeaddress2())));
        cellList.add(new PdfPCell(new Phrase("City:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getCity())));
        cellList.add(new PdfPCell(new Phrase("Country:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getCountry())));
        cellList.add(new PdfPCell(new Phrase("Postal Code:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getPostalcode())));
        cellList.add(new PdfPCell(new Phrase("Telephone Number:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getMobilephone())));
        cellList.add(new PdfPCell(new Phrase("Fax:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getBusinessfax())));
        cellList.add(new PdfPCell(new Phrase("I.D:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getIdnumber())));


        cellList.add(new PdfPCell(new Phrase("Nationality Of Passport:")));
        cellList.add(new PdfPCell(new Phrase(this.travelD.getCountry())));
        cellList.add(new PdfPCell(new Phrase("Passport Number:")));
        cellList.add(new PdfPCell(new Phrase(this.travelD.getPassportnumber())));
        cellList.add(new PdfPCell(new Phrase("Company Contact:")));
        cellList.add(new PdfPCell(new Phrase(this.travelerP.getBusinessphone())));
        cellList.add(new PdfPCell(new Phrase("Destination:")));
        cellList.add(new PdfPCell(new Phrase(this.itinerary.getDestinationCity())));
        cellList.add(new PdfPCell(new Phrase("Date of Departure:")));
        cellList.add(new PdfPCell(new Phrase("")));
        //cellList.add(new PdfPCell(new Phrase(this.itinerary.getDatefrom().toString())));

        cellList.add(new PdfPCell(new Phrase("Date of Return:")));
        cellList.add(new PdfPCell(new Phrase("")));
        //cellList.add(new PdfPCell(new Phrase(this.itinerary.getDateto().toString())));
        cellList.add(new PdfPCell(new Phrase("Ticket Number/ Reference Number:")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getTicketnum())));
        cellList.add(new PdfPCell(new Phrase("Voyager Number:")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getVoyagernum())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Forex Breakdown
         */
        table = new PdfPTable(2);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Forex Breakdown", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Travellers Cheques:")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getCurrencycheque()
                + " "
                + this.viewForX.getTravelerscheques())));

        cellList.add(new PdfPCell(new Phrase("Foreign Cash:")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getCurrencycash()
                + " "
                + this.viewForX.getCash())));

        cellList.add(new PdfPCell(new Phrase("CC Type (VISA, DINERS, ETC):")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getCctype())));

        cellList.add(new PdfPCell(new Phrase("Number:")));
        cellList.add(new PdfPCell(new Phrase("Please fill in here")));
        cellList.add(new PdfPCell(new Phrase("Last 3 digits:")));
        cellList.add(new PdfPCell(new Phrase("Please fill in here")));
        cellList.add(new PdfPCell(new Phrase("Expiry Date:")));
       
        cellList.add(new PdfPCell(new Phrase("Please fill in here")));
        //cellList.add(new PdfPCell(new Phrase(this.viewForX.getCcexpirydate().toString())));

        cellList.add(new PdfPCell(new Phrase("Amount:")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getCurrencycc()
                + " "
                + this.viewForX.getCcpaymentamount())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }

        document.add(table);

        /**
         * Delivery Information
         */
        table = new PdfPTable(2);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Delivery Information", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Delivery - Date and Time:")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getDateofrequired().toString())));
        cellList.add(new PdfPCell(new Phrase("Date and Time: Will be confirmed by Forex Consultant:")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getDatewillbeconfirmed().toString())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }

        document.add(table);

        /**
         * Additional Information
         */
        table = new PdfPTable(2);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Additional Information", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Reason for trael:")));
        cellList.add(new PdfPCell(new Phrase(this.viewForX.getReasonfortravel())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }

        document.add(table);
    }
View Full Code Here

        newLine(document);

        /**
         * Personal Details
         */
        PdfPTable table = new PdfPTable(2); // 2 columns.

        ArrayList<PdfPCell> cellList = new ArrayList<PdfPCell>();
        cellList.add(new PdfPCell(new Phrase("Staff ID:")));
        cellList.add(new PdfPCell(new Phrase(this.profileRef.getStaffid())));
        cellList.add(new PdfPCell(new Phrase("Title:")));
        cellList.add(new PdfPCell(new Phrase(this.profileRef.getTitle())));
        cellList.add(new PdfPCell(new Phrase("Surname:")));
        cellList.add(new PdfPCell(new Phrase(this.profileRef.getFamilyname())));
        cellList.add(new PdfPCell(new Phrase("First Name:")));
        cellList.add(new PdfPCell(new Phrase(this.profileRef.getFirstname())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Travel Details
         */
        table = new PdfPTable(2);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Travel", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Application Name:")));
        cellList.add(new PdfPCell(new Phrase(this.appRef.getDescription())));
        cellList.add(new PdfPCell(new Phrase("Date of Initial Departure:")));
        cellList.add(new PdfPCell(new Phrase(df.format(this.travelRef.getDatedeparture()))));

        cellList.add(new PdfPCell(new Phrase("Date of Final Return:")));
        cellList.add(new PdfPCell(new Phrase(df.format(this.travelRef.getDatereturn()))));

        cellList.add(new PdfPCell(new Phrase("Purpose of Travel:")));
        cellList.add(new PdfPCell(new Phrase(this.travelRef.getDescription())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }

        document.add(table);

        /**
         * Itinerary Details
         */
        table = new PdfPTable(4);
        table.setWidthPercentage(90f);
        table.setHeaderRows(1);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Itinerary", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Destination", bold)));
        cellList.add(new PdfPCell(new Phrase("Leave Type", bold)));
        cellList.add(new PdfPCell(new Phrase("Travel Day/ Work Day", bold)));


        for (Itinerary i : hops) {
            //cellList.add(new PdfPCell(new Phrase(df.format(i.getDate()))));
            cellList.add(new PdfPCell(new Phrase("BLANK")));
            cellList.add(new PdfPCell(new Phrase(i.getDestinationCity())));
            cellList.add(new PdfPCell(new Phrase(i.getLeavetype())));
            cellList.add(new PdfPCell(new Phrase(i.getTravelday())));
        }

        for (int i = 0; i < cellList.size(); i++) {
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Quote CostCenter
         */
        table = new PdfPTable(2);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Quotes", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Cost Center:")));
        cellList.add(new PdfPCell(new Phrase(this.quoteRef.getCostcenter())));

        for (int i = 0; i < cellList.size(); i++) {
            if (i % 2 == 0) {
                cellList.get(i).setBorder(Rectangle.NO_BORDER);
            }
            table.addCell(cellList.get(i));
        }

        document.add(table);

        /**
         * Flight Quotes
         */
        table = new PdfPTable(4);
        table.setWidthPercentage(90f);
        table.setHeaderRows(1);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Flight Quotes", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("From", bold)));
        cellList.add(new PdfPCell(new Phrase("To", bold)));
        cellList.add(new PdfPCell(new Phrase("Airline", bold)));
        cellList.add(new PdfPCell(new Phrase("Cost Quoted", bold)));


        for (Flightquotes f : flights) {
            cellList.add(new PdfPCell(new Phrase(f.getFlightfromCity())));
            cellList.add(new PdfPCell(new Phrase(f.getFlighttoCity())));
            cellList.add(new PdfPCell(new Phrase(f.getQuotesource())));
            cellList.add(new PdfPCell(new Phrase(f.getCurrency() + " " + f.getQuotecost().toString())));
        }

        for (int i = 0; i < cellList.size(); i++) {
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Car Quotes
         */
        table = new PdfPTable(4);
        table.setWidthPercentage(90f);
        table.setHeaderRows(1);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Flight Quotes", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Collect Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Return Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Rental Company", bold)));
        cellList.add(new PdfPCell(new Phrase("Cost Quoted", bold)));


        for (Carquotes c : cars) {
            cellList.add(new PdfPCell(new Phrase(df.format(c.getDatecollect()))));
            cellList.add(new PdfPCell(new Phrase(df.format(c.getDatereturn()))));
            cellList.add(new PdfPCell(new Phrase(c.getProvider())));
            cellList.add(new PdfPCell(new Phrase(c.getCurrency() + " " + c.getQuotecost().toString())));
        }

        for (int i = 0; i < cellList.size(); i++) {
            table.addCell(cellList.get(i));
        }
        document.add(table);

        /**
         * Accommodation Quotes
         */
        table = new PdfPTable(5);
        table.setWidthPercentage(90f);
        table.setHeaderRows(1);
        cellList = new ArrayList<PdfPCell>();
        newLine(document);
        document.add(new Paragraph("Accomodation Quotes", mediumFont));
        newLine(document);
        cellList.add(new PdfPCell(new Phrase("Location", bold)));
        cellList.add(new PdfPCell(new Phrase("Checkin Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Checkout Date", bold)));
        cellList.add(new PdfPCell(new Phrase("Hotel", bold)));
        cellList.add(new PdfPCell(new Phrase("Cost Quoted", bold)));


        for (Accomodationquotes a : hotels) {
            cellList.add(new PdfPCell(new Phrase(a.getCity())));
            cellList.add(new PdfPCell(new Phrase(df.format(a.getDatecheckin()))));
            cellList.add(new PdfPCell(new Phrase(df.format(a.getDatecheckout()))));
            cellList.add(new PdfPCell(new Phrase(a.getAccomodationprovider())));
            cellList.add(new PdfPCell(new Phrase(a.getCurrency() + " " + a.getQuotecost().toString())));
        }

        for (int i = 0; i < cellList.size(); i++) {
            table.addCell(cellList.get(i));
        }
        document.add(table);
    }
View Full Code Here

     
      System.out.println(list.size());
     
      PdfWriter.getInstance(doc, ba);
      doc.open();
      PdfPTable table=new PdfPTable(i);
      Iterator it =list.iterator();
            while(it.hasNext())
            {
              Object o[]=(Object [])it.next();
             
              //                   System.out.println(o[0] + "==" + o[1]);
                 
               //  String str=(String) it.next();
                 for(int j=0; j<i; j++ )
                 {
                   System.out.println(o[j]);
                  
        //table.addCell(o[j]);//String.valueOf(list.get(i).getProcessName()));
        table.addCell(String.valueOf(o[j]));
       
      }}
            System.out.println("loop complate");
      doc.add(table);
      System.out.println("add table complate");
View Full Code Here

                titre.setSpacingAfter(30f);

                document.add(titre);

                int prixTotal = 0;
                PdfPTable table = new PdfPTable(3);

                table.addCell(new Paragraph("Epreuve", FontFactory.getFont(FontFactory.HELVETICA, 14, Font.BOLDITALIC, BaseColor.BLACK)));
                table.addCell(new Paragraph("Prix unitaire", FontFactory.getFont(FontFactory.HELVETICA, 14, Font.BOLDITALIC, BaseColor.BLACK)));
                table.addCell(new Paragraph("nombre", FontFactory.getFont(FontFactory.HELVETICA, 14, Font.BOLDITALIC, BaseColor.BLACK)));
                for (ArticlePanier a : panier) {
                    table.addCell(" " + a.getEpreuve().getNom() + " ");
                    table.addCell(" " + 15 + " Euros");
                    table.addCell(" " + a.getQuantite());
                }
                document.add(table);
//                Paragraph paraPrixTotal = new Paragraph("Prix total HT : " + panier.getPrixTotalHT() + " Euros");
//                paraPrixTotal.setSpacingBefore(20f);
//                document.add(paraPrixTotal);
View Full Code Here

        e.printStackTrace();
      }
    }
    float[] columnWidths = new float[columns];
    Arrays.fill(columnWidths, (width / columns) / width * 100);
    imageTable = new PdfPTable(columnWidths);
    imageTable.setWidthPercentage(100F);
    imageTable.getDefaultCell().setBorder(0);
    imageCount = 0;
    mustAddTable = false;
  }
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.