Example usage for com.itextpdf.text.pdf PdfPCell setBorderWidthTop

List of usage examples for com.itextpdf.text.pdf PdfPCell setBorderWidthTop

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfPCell setBorderWidthTop.

Prototype

public void setBorderWidthTop(final float borderWidthTop) 

Source Link

Document

Sets the width of the top border.

Usage

From source file:com.gp.cong.logisoft.reports.DeliveryOrderPdfCreator.java

public PdfPTable tablebodyTwo(FclBl bl, String deliveryTo, String deliveryContact, String deliveryEmail,
        String deliveryPhone, String deliveryFax, String notify, String realPath) throws Exception {
    PdfPTable table = new PdfPTable(5);
    table.setWidths(new float[] { 2f, 2f, 2f, 2f, 2f });
    table.setWidthPercentage(100);/*www  .ja va  2 s  .com*/
    PdfPCell cell = null;
    Paragraph p = null;

    cell = new PdfPCell();
    cell.setColspan(2);
    cell.setBorderWidthBottom(0f);
    p = new Paragraph(8f, "FOR DELIVERY TO:", blackFontForAR);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setColspan(2);
    cell.setBorderWidthBottom(0f);
    p = new Paragraph(8f, "NOTIFY:", blackFontForAR);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setColspan(2);
    cell.setBorderWidthTop(0f);
    p = new Paragraph(8f, deliveryTo, blackFont);
    cell.addElement(p);
    p = new Paragraph(8f, "Contact Name: " + deliveryContact, blackFont);
    cell.addElement(p);
    p = new Paragraph(8f, "Phone: " + deliveryPhone, blackFont);
    cell.addElement(p);
    p = new Paragraph(8f, "Fax: " + deliveryFax, blackFont);
    cell.addElement(p);
    p = new Paragraph(8f, "Email: " + deliveryEmail, blackFont);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setBorderWidthBottom(0f);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setColspan(2);
    cell.setBorderWidthTop(0f);
    cell.setBorderWidthTop(0f);
    p = new Paragraph(8f, notify, blackFont);
    cell.addElement(p);
    table.addCell(cell);

    return table;
}

From source file:com.gp.cong.logisoft.reports.DeliveryOrderPdfCreator.java

public PdfPTable tablebodyThree(FclBl bl, FclDoorDelivery fclDoorDelivery, MessageResources messageResources,
        String realPath) throws Exception {
    PdfPTable table = new PdfPTable(4);
    table.setWidths(new float[] { 2f, 1f, 5f, 2f });
    table.setWidthPercentage(100);/* ww  w.j  a  va2s. c  o m*/

    PdfPCell cell = null;
    Paragraph p = null;

    cell = new PdfPCell();
    p = new Paragraph(8f, "MARKS AND NUMBERS", blackFontForAR);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    p = new Paragraph(8f, "PIECES", blackFontForAR);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    p = new Paragraph(8f, "DESCRIPTION OF PACKAGES AND GOODS", blackFontForAR);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    p = new Paragraph(8f, "GROSS WEIGHT LBS", blackFontForAR);
    cell.addElement(p);
    table.addCell(cell);

    FclBlContainerDAO fclBlContainerDAO = new FclBlContainerDAO();
    Set<FclBlContainer> containerSet = bl.getFclcontainer();
    for (Iterator iter = containerSet.iterator(); iter.hasNext();) {
        FclBlContainer fclBlContainer = (FclBlContainer) iter.next();
        StringBuilder tempSizeLegened = new StringBuilder();
        String sizeLegend = fclBlContainer.getSizeLegend() != null
                ? (fclBlContainer.getSizeLegend().getCodedesc() != null
                        ? fclBlContainer.getSizeLegend().getCodedesc()
                        : "")
                : "";
        int index = sizeLegend.indexOf("=");
        if (index != -1) {
            tempSizeLegened.append("1X");
            String tempSize = sizeLegend.substring(index + 1, sizeLegend.length());
            if (tempSize.equalsIgnoreCase(messageResources.getMessage("container40HC"))) {
                tempSize = "40" + "'" + "HC";
            } else if (tempSize.equalsIgnoreCase(messageResources.getMessage("container40NOR"))) {
                tempSize = "40" + "'" + "NOR";
            } else {
                tempSize = tempSize + "'";
            }
            tempSizeLegened.append(tempSize);
        } else {
            tempSizeLegened.append("");
        }

        StringBuilder marksNumber = new StringBuilder();
        if (null != bl.getPrintContainersOnBL() && bl.getPrintContainersOnBL().equalsIgnoreCase("Yes")) {
            marksNumber.append(tempSizeLegened);
            marksNumber.append("\n");
            marksNumber.append(fclBlContainer.getTrailerNo() != null ? fclBlContainer.getTrailerNo() : "");
            marksNumber.append("\n");
            marksNumber.append("SEAL: ");
            marksNumber.append(" " + fclBlContainer.getSealNo() != null ? fclBlContainer.getSealNo() : "");
        }
        //            HelperClass helperClass = new HelperClass();
        //
        //            List marksList = helperClass.splitDescrption(helperClass.wrapAddress(fclBlContainer.getMarks()), DESC_SIZE + 1);
        //            if (!marksList.isEmpty()) {
        //                marksNumber.append("\n");
        //                marksNumber.append(marksList.get(0).toString());
        //                marksList.remove(0);
        //            }

        List<FclBlMarks> fclMarksList = fclBlContainerDAO.getPakagesDetails(fclBlContainer.getTrailerNoId());
        if (fclMarksList != null && !fclMarksList.isEmpty()) {

            cell = new PdfPCell();
            cell.setBorderWidthBottom(0f);
            cell.setBorderWidthTop(0f);
            p = new Paragraph(8f, marksNumber.toString(), blackFont);
            cell.addElement(p);
            table.addCell(cell);

            cell = new PdfPCell();
            cell.setBorderWidthBottom(0f);
            cell.setBorderWidthTop(0f);
            table.addCell(cell);

            cell = new PdfPCell();
            cell.setBorderWidthBottom(0f);
            cell.setBorderWidthTop(0f);
            table.addCell(cell);

            cell = new PdfPCell();
            cell.setBorderWidthBottom(0f);
            cell.setBorderWidthTop(0f);
            table.addCell(cell);

            for (FclBlMarks fclBlmarks : fclMarksList) {

                cell = new PdfPCell();
                cell.setBorderWidthBottom(0f);
                cell.setBorderWidthTop(0f);
                table.addCell(cell);

                cell = new PdfPCell();
                cell.setBorderWidthBottom(0f);
                cell.setBorderWidthTop(0f);
                p = new Paragraph(8f, "" + fclBlmarks.getNoOfPkgs(), blackFont);
                cell.addElement(p);
                table.addCell(cell);

                cell = new PdfPCell();
                cell.setBorderWidthBottom(0f);
                cell.setBorderWidthTop(0f);
                p = new Paragraph(8f, fclBlmarks.getDescPckgs(), blackFont);
                cell.addElement(p);
                table.addCell(cell);

                cell = new PdfPCell();
                cell.setBorderWidthBottom(0f);
                cell.setBorderWidthTop(0f);
                p = new Paragraph(8f, "" + fclBlmarks.getNetweightLbs(), blackFont);
                cell.addElement(p);
                table.addCell(cell);
            }
        }
    }

    cell = new PdfPCell();
    cell.setBorderWidthTop(0f);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorderWidthTop(0f);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorderWidthTop(0f);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorderWidthTop(0f);
    table.addCell(cell);

    return table;
}

From source file:com.gp.cong.logisoft.reports.DeliveryOrderPdfCreator.java

public PdfPTable tablebodyFour(FclBl bl, String billing, String realPath) throws Exception {
    PdfPTable table = new PdfPTable(5);
    table.setWidths(new float[] { 3f, 3f, 1f, 2f, 1f });
    table.setWidthPercentage(100);/*w ww .j a va 2 s  .  co  m*/

    PdfPCell cell = null;
    Paragraph p = null;

    cell = new PdfPCell();
    cell.setBorder(0);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorderWidthBottom(0f);
    p = new Paragraph(8f, "PRE-PAID/COLLECT/3rd PARTY", blackFontForAR);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setColspan(2);
    cell.setBorder(0);
    p = new Paragraph(8f, "Received in Good Order By:", blackFontForAR);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setFixedHeight(25f);
    cell.setBorder(0);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorderWidthTop(0f);
    p = new Paragraph(8f, billing, blackFont);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setColspan(2);
    cell.setBorder(0);
    p = new Paragraph(8f, "", blackFontForAR);
    cell.addElement(p);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorder(0);
    cell.setColspan(3);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setColspan(2);
    cell.setBorderWidthTop(0f);
    cell.setBorderWidthLeft(0f);
    cell.setBorderWidthRight(0f);
    p = new Paragraph(8f, "Signature:", blackFontForAR);
    cell.addElement(p);
    table.addCell(cell);

    return table;
}

From source file:com.pdfwriter.PrintInventoryReport.java

public void create(ObservableList list, String totalSales) {
    try {//from   w  w w.j a  va2 s.  c  o m
        Document document = new Document(PageSize.LETTER);
        document.setMargins(1, 1, 1, 1);

        PdfWriter.getInstance(document, new FileOutputStream(filename));
        document.open();
        Font font2 = new Font(Font.FontFamily.UNDEFINED, 10, Font.BOLD);
        PdfPTable table = new PdfPTable(5);
        table.setWidthPercentage(95);
        table.setWidths(new int[] { 40, 40, 40, 40, 40 });
        PdfPCell cell;

        cell = new PdfPCell(new Phrase("", font2));
        cell.setBorder(0);
        cell.setColspan(8);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_CENTER);
        cell.setBorderWidthTop(0);

        cell.setBorderWidthBottom(0);
        table.addCell(cell);

        cell = new PdfPCell(
                new Phrase("KELNOVI SHOPPING BOTIQUE", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)));
        cell.setColspan(10);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorder(0);
        table.addCell(cell);

        cell = new PdfPCell(
                new Phrase("Pondol,Loon, Bohol", new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD)));
        cell.setColspan(10);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorder(0);
        table.addCell(cell);

        cell = new PdfPCell(
                new Phrase("Phone/Fax#:000-000-000", new Font(Font.FontFamily.UNDEFINED, 9, Font.UNDERLINE)));
        cell.setColspan(10);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorder(0);
        table.addCell(cell);

        cell = new PdfPCell(new Phrase(" "));
        cell.setColspan(10);
        cell.setRowspan(3);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorder(0);
        table.addCell(cell);

        cell = new PdfPCell(new Phrase("SALES REPORT", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)));
        cell.setColspan(10);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorder(0);
        table.addCell(cell);

        cell = new PdfPCell(new Phrase(" "));
        cell.setColspan(10);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorder(0);
        table.addCell(cell);

        cell = new PdfPCell(new Phrase("NO."));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorder(14);
        cell.setBackgroundColor(BaseColor.GRAY);
        table.addCell(cell);

        cell = new PdfPCell(new Phrase("PRODUCT NAME"));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorder(14);
        cell.setBackgroundColor(BaseColor.GRAY);
        table.addCell(cell);

        cell = new PdfPCell(new Phrase("PRICE"));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorder(14);
        cell.setBackgroundColor(BaseColor.GRAY);
        table.addCell(cell);

        cell = new PdfPCell(new Phrase("QUANTITY"));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorder(14);
        cell.setBackgroundColor(BaseColor.GRAY);
        table.addCell(cell);

        cell = new PdfPCell(new Phrase("AMOUNT PAYABLE"));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorder(14);
        cell.setBackgroundColor(BaseColor.GRAY);
        table.addCell(cell);

        for (int i = 0; i < list.size(); i++) {
            it = (ProductClass) list.get(i);

            cell = new PdfPCell(new Phrase("" + it.idProperty().get()));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setBorder(14);
            table.addCell(cell);

            cell = new PdfPCell(new Phrase("" + it.productDescriptionProperty().get()));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setBorder(14);
            table.addCell(cell);

            cell = new PdfPCell(new Phrase("" + it.productPriceProperty().get()));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setBorder(14);
            table.addCell(cell);

            cell = new PdfPCell(new Phrase("" + it.productQtyProperty().get()));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setBorder(14);
            table.addCell(cell);
            //totalSales.setText(String.format("%,.2f",globalSales));

            cell = new PdfPCell(new Phrase(
                    String.format("%,.2f", Double.parseDouble(it.productTotalSalesProperty().get()))));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            cell.setBorder(14);
            table.addCell(cell);

        }

        cell = new PdfPCell(new Phrase(" "));
        cell.setColspan(10);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setBorder(0);
        table.addCell(cell);
        cell = new PdfPCell(new Phrase(" "));
        cell.setColspan(10);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setBorder(0);
        table.addCell(cell);

        cell = new PdfPCell(new Phrase("TOTAL AMOUNT PAYABLE:"));
        cell.setColspan(10);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setBorder(0);
        table.addCell(cell);

        cell = new PdfPCell(
                new Phrase("Php " + totalSales, new Font(Font.FontFamily.UNDEFINED, 14, Font.UNDERLINE)));
        cell.setColspan(10);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setBorder(0);
        table.addCell(cell);

        cell = new PdfPCell(new Phrase(" "));
        cell.setColspan(10);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setBorder(0);
        table.addCell(cell);

        cell = new PdfPCell(new Phrase("Approved by:"));
        cell.setColspan(10);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setBorder(0);
        table.addCell(cell);

        cell = new PdfPCell(new Phrase("MICHAEL NOVI MALUENDA II",
                new Font(Font.FontFamily.UNDEFINED, 14, Font.UNDERLINE)));
        cell.setColspan(10);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setBorder(0);
        table.addCell(cell);
        cell = new PdfPCell(new Phrase("General Manager"));
        cell.setColspan(10);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setBorder(0);
        table.addCell(cell);

        cell = new PdfPCell(new Phrase(" "));
        cell.setColspan(10);
        cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setBorder(0);
        table.addCell(cell);

        document.add(table);
        document.close();
        openFile();

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.softwaremagico.tm.pdf.small.SmallCharacterSheet.java

License:Open Source License

protected PdfPTable createCharacterContent(CharacterPlayer characterPlayer) throws Exception {
    float[] widths = { 2.2f, 1f };
    PdfPTable mainTable = new PdfPTable(widths);
    BaseElement.setTablePropierties(mainTable);
    mainTable.getDefaultCell().setPadding(0);

    PdfPTable infoTable = CharacterBasicsReducedTableFactory.getCharacterBasicsTable(characterPlayer);
    PdfPCell infoCell = new PdfPCell(infoTable);
    infoCell.setBorderWidthTop(0);
    infoCell.setBorderWidthLeft(0);//from www .  ja  va  2s  .c o m
    infoCell.setBorderWidthBottom(1);
    mainTable.addCell(infoCell);

    PdfPTable learnedSkillsTable = LearnedSkillsTable.getSkillsTable(characterPlayer, getLanguage());
    PdfPCell learnedSkillsCell = new PdfPCell(learnedSkillsTable);
    learnedSkillsCell.setColspan(2);
    learnedSkillsCell.setRowspan(3);
    learnedSkillsCell.setBorderWidthTop(0);
    learnedSkillsCell.setBorderWidthRight(0);
    mainTable.addCell(learnedSkillsCell);

    PdfPTable basicTable = new PdfPTable(new float[] { 5f, 4f });
    BaseElement.setTablePropierties(basicTable);
    basicTable.getDefaultCell().setBorder(0);

    PdfPTable characteristicsTable = CharacteristicsTableFactory.getCharacteristicsBasicsTable(characterPlayer);
    PdfPCell characteristicCell = new PdfPCell(characteristicsTable);
    characteristicCell.setBorderWidthLeft(0);
    basicTable.addCell(characteristicCell);

    PdfPTable naturalSkillsTable = NaturalSkillsTable.getSkillsTable(characterPlayer, getLanguage());
    PdfPCell naturalSkillsCell = new PdfPCell(naturalSkillsTable);
    naturalSkillsCell.setBorderWidthRight(0);
    basicTable.addCell(naturalSkillsCell);

    PdfPCell basicComposedCell = new PdfPCell(basicTable);
    basicComposedCell.setBorder(0);
    mainTable.addCell(basicComposedCell);

    PdfPTable composedTable = new PdfPTable(new float[] { 5f, 2f });

    PdfPTable blessingsTable = new BlessingTable(characterPlayer);
    PdfPCell blessingsCell = new PdfPCell(blessingsTable);
    blessingsCell.setBorderWidthLeft(0);
    blessingsCell.setBorderWidthBottom(1);
    composedTable.addCell(blessingsCell);

    PdfPTable beneficesTable = new BeneficesTable(characterPlayer);
    PdfPCell beneficesCell = new PdfPCell(beneficesTable);
    beneficesCell.setBorderWidthBottom(1);
    composedTable.addCell(beneficesCell);

    PdfPCell composedCell = new PdfPCell(composedTable);
    composedCell.setRowspan(2);
    composedCell.setBorder(0);
    mainTable.addCell(composedCell);

    PdfPTable armourTable = new ArmourTable(characterPlayer);
    PdfPCell armourCell = new PdfPCell(armourTable);
    armourCell.setBorderWidthRight(0);
    armourCell.setBorderWidthBottom(1);
    mainTable.addCell(armourCell);

    PdfPTable fightTable = new PdfPTable(new float[] { 3f, 5f, 1f });

    if (characterPlayer != null
            && (characterPlayer.getSelectedPowers().isEmpty() && !characterPlayer.getCybernetics().isEmpty())) {
        PdfPTable cyberneticsTable = new CyberneticsTable(characterPlayer);
        PdfPCell cyberneticsCell = new PdfPCell(cyberneticsTable);
        cyberneticsCell.setBorderWidthLeft(0);
        fightTable.addCell(cyberneticsCell);
    } else {
        PdfPTable occultismTable = new OccultismTable(characterPlayer, getLanguage());
        PdfPCell occultismCell = new PdfPCell(occultismTable);
        occultismCell.setBorderWidthLeft(0);
        fightTable.addCell(occultismCell);
    }

    PdfPTable weaponsTable = new WeaponsTable(characterPlayer);
    fightTable.addCell(weaponsTable);

    PdfPCell victoryPointsCell = new PdfPCell(new VerticalVictoryPointsTable());
    victoryPointsCell.setPadding(0);
    victoryPointsCell.setRowspan(3);
    fightTable.addCell(victoryPointsCell);

    PdfPTable vitalityTable = new VitalityTable(characterPlayer);
    PdfPCell vitalityCell = new PdfPCell(vitalityTable);
    vitalityCell.setColspan(2);
    vitalityCell.setBorderWidth(1);
    fightTable.addCell(vitalityCell);

    PdfPTable wyrdTable = new WyrdTable(characterPlayer);
    PdfPCell wyrdCell = new PdfPCell(wyrdTable);
    wyrdCell.setBorderWidth(1);
    wyrdCell.setColspan(2);
    fightTable.addCell(wyrdCell);

    PdfPCell fightCell = new PdfPCell(fightTable);
    fightCell.setBorder(0);
    fightCell.setColspan(2);

    mainTable.addCell(fightCell);
    return mainTable;
}

From source file:cz.zcu.kiv.eegdatabase.logic.pdf.ReservationPDF.java

License:Apache License

public static PdfPTable formatReservation(Reservation reservation) {
    int padding = 5;

    GregorianCalendar created = new GregorianCalendar();
    created.setTime(reservation.getCreationTime());
    GregorianCalendar startTime = new GregorianCalendar();
    startTime.setTime(reservation.getStartTime());
    GregorianCalendar endTime = new GregorianCalendar();
    endTime.setTime(reservation.getEndTime());

    String personName = BookingRoomUtils.formatPersonName(reservation.getPerson());

    Font title = FontFactory.getFont("Trebuchet MS", "utf-8", 15, Font.BOLD, new BaseColor(59, 70, 00));
    Font header = FontFactory.getFont(FontFactory.TIMES_BOLD, 13, Font.BOLD, BaseColor.BLACK);
    Font value = FontFactory.getFont(FontFactory.TIMES, 13);

    PdfPTable table = new PdfPTable(2);
    PdfPCell cell;
    Phrase phrase;/*from w ww. ja v a  2s .c o m*/

    phrase = new Phrase("Reservation by " + personName);
    phrase.setFont(title);
    cell = new PdfPCell(phrase);
    cell.setColspan(2);
    cell.setBorder(0);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorderWidthTop(1);
    cell.setBorderWidthLeft(1);
    cell.setBorderWidthRight(1);
    cell.setPadding(padding);
    cell.setPaddingBottom(5);
    table.addCell(cell);

    phrase = new Phrase("Date: ");
    phrase.setFont(header);
    cell = new PdfPCell(phrase);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorder(0);
    cell.setBorderWidthLeft(1);
    cell.setPadding(padding);
    table.addCell(cell);

    phrase = new Phrase(BookingRoomUtils.getDate(startTime));
    phrase.setFont(value);
    cell = new PdfPCell(phrase);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorder(0);
    cell.setBorderWidthRight(1);
    cell.setPadding(padding);
    table.addCell(cell);

    phrase = new Phrase("Start: ");
    phrase.setFont(header);
    cell = new PdfPCell(phrase);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorder(0);
    cell.setBorderWidthLeft(1);
    cell.setPadding(padding);
    table.addCell(cell);

    phrase = new Phrase(BookingRoomUtils.getHoursAndMinutes(startTime));
    phrase.setFont(value);
    cell = new PdfPCell(phrase);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorder(0);
    cell.setBorderWidthRight(1);
    cell.setPadding(padding);
    table.addCell(cell);

    phrase = new Phrase("End: ");
    phrase.setFont(header);
    cell = new PdfPCell(phrase);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorder(0);
    cell.setBorderWidthLeft(1);
    cell.setBorderWidthBottom(1);
    cell.setPadding(padding);
    table.addCell(cell);

    phrase = new Phrase(BookingRoomUtils.getHoursAndMinutes(endTime));
    phrase.setFont(value);
    cell = new PdfPCell(phrase);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorder(0);
    cell.setBorderWidthRight(1);
    cell.setBorderWidthBottom(1);
    cell.setPadding(padding);
    table.addCell(cell);

    table.setSpacingBefore(10);
    table.setSpacingAfter(10);

    return table;
}

From source file:es.sm2.openppm.front.utils.DocumentUtils.java

License:Open Source License

/**
 * /*from w ww  . j a  v  a  2s  .com*/
 * @param content
 * @param font
 * @param borderTop
 * @param borderRight
 * @param borderBottom
 * @param borderLeft
 * @return
 */
private static PdfPCell prepareHeaderCell(String content, Font font, Float borderTop, Float borderRight,
        Float borderBottom, Float borderLeft) {
    PdfPCell cell = new PdfPCell(new Paragraph(content, font));
    cell.setBorderWidthTop(borderTop);
    cell.setBorderWidthRight(borderRight);
    cell.setBorderWidthBottom(borderBottom);
    cell.setBorderWidthLeft(borderLeft);
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell.setPaddingLeft(5F);

    return cell;
}

From source file:es.sm2.openppm.front.utils.DocumentUtils.java

License:Open Source License

/**
 * /*from www  .j  a v a 2s . c om*/
 * @param content
 * @param font
 * @param borderTop
 * @param borderRight
 * @param borderBottom
 * @param borderLeft
 * @return
 */
private static PdfPCell prepareCell(String content, Font font, Float borderTop, Float borderRight,
        Float borderBottom, Float borderLeft) {
    PdfPCell cell = new PdfPCell(new Paragraph(content, font));
    cell.setBorderWidthTop(borderTop);
    cell.setBorderWidthRight(borderRight);
    cell.setBorderWidthBottom(borderBottom);
    cell.setBorderWidthLeft(borderLeft);
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell.setPaddingBottom(3F);
    cell.setPaddingLeft(5F);

    return cell;
}

From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.AbstractContentFactory.java

License:Open Source License

protected void addTableCaption(PdfPTable table, String caption) {

    PdfPCell cell = getContentCell();//from www. ja v a2  s .c  o  m
    cell.setColspan(table.getNumberOfColumns());
    table.addCell(cell);
    PdfPCell captionCell = new PdfPCell(new Phrase(caption, TABLE_CAPTION));
    captionCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    captionCell.setPaddingBottom(5);
    captionCell.setBorder(Rectangle.TOP);
    captionCell.setBorderWidthTop(1.5f);
    captionCell.setPaddingBottom(7);
    captionCell.setPaddingTop(2);
    captionCell.setColspan(table.getNumberOfColumns());
    table.addCell(captionCell);
}

From source file:eu.aniketos.wp1.ststool.report.pdfgenerator.AbstractContentFactory.java

License:Open Source License

protected PdfPCell getHeaderCell(String[] header) {

    Phrase p = new Phrase();
    p.setFont(TABLE_HEADER);/*  www .  j a v a 2 s .  c o m*/
    for (String s : header) {
        p.add(new Chunk(s));
        p.add(Chunk.NEWLINE);
    }
    PdfPCell cell = new PdfPCell(p);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorder(Rectangle.BOTTOM | Rectangle.TOP);
    cell.setBorderWidthTop(1.5f);
    cell.setBorderWidthBottom(1.5f);
    cell.setPaddingBottom(7);
    cell.setPaddingTop(2);
    return cell;
}