Example usage for com.lowagie.text.pdf PdfPTable PdfPTable

List of usage examples for com.lowagie.text.pdf PdfPTable PdfPTable

Introduction

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

Prototype

public PdfPTable(PdfPTable table) 

Source Link

Document

Constructs a copy of a PdfPTable.

Usage

From source file:biblivre3.administration.reports.HoldingCreationByDatetReport.java

License:Open Source License

private PdfPTable createTable(List<String[]> dataList) {
    PdfPTable table = new PdfPTable(4);
    table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
    createHeader(table);//from w w w.  j  a va  2 s. c o  m
    PdfPCell cell;
    for (String[] data : dataList) {
        String name = data[1];
        int total = Integer.valueOf(data[2]);
        if (totalUsuario.containsKey(name)) {
            totalUsuario.put(name, totalUsuario.get(name) + total);
        } else {
            totalUsuario.put(name, total);
        }
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[0])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(name)));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(String.valueOf(total))));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
    }
    return table;
}

From source file:biblivre3.administration.reports.LateReturnLendingsReport.java

License:Open Source License

private PdfPTable createTable(List<String[]> lendings) {
    PdfPTable table = new PdfPTable(6);
    table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
    table.setWidthPercentage(100f);//from  w w  w  .  j  ava  2s .  c o  m

    createHeader(table);

    PdfPCell cell;
    for (String[] lending : lendings) {
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(lending[0])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(lending[1])));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(lending[2])));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(lending[3])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
    }
    return table;
}

From source file:biblivre3.administration.reports.LendingsByDateReport.java

License:Open Source License

private PdfPTable createTable(LendingsByDateReportDto dto) {
    PdfPTable table = new PdfPTable(5);
    table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
    table.setWidthPercentage(100f);/*from   www.j  a v a  2  s . c  o m*/
    PdfPCell cell;
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_LENDINGS"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_TITLE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setColspan(2);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_AUTHOR"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setColspan(2);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    //Table body
    if (dto.getData() == null || dto.getData().isEmpty())
        return table;
    for (String[] data : dto.getData()) {
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[0])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[1])));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[2])));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
    }
    return table;
}

From source file:biblivre3.administration.reports.RequestsByDateReport.java

License:Open Source License

private PdfPTable createTable(List<String[]> dataList) {
    PdfPTable table = new PdfPTable(7);
    table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
    table.setWidthPercentage(100f);/*from w  ww .j  a v a2  s  .  c o  m*/
    createHeader(table);
    PdfPCell cell;
    String lastQuotationId = "0";
    String requester = null;
    String title = null;
    String quantity = null;
    String unit_value = null;
    String total_value = null;
    for (String[] data : dataList) {
        if (!data[0].equals(lastQuotationId)) {
            if (!lastQuotationId.equals("0")) {
                cell = new PdfPCell(new Paragraph(this.getNormalChunk(requester)));
                cell.setColspan(2);
                cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
                cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
                table.addCell(cell);
                cell = new PdfPCell(new Paragraph(this.getNormalChunk(title)));
                cell.setColspan(2);
                cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
                cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
                table.addCell(cell);
                cell = new PdfPCell(new Paragraph(this.getNormalChunk(quantity)));
                cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
                cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
                table.addCell(cell);
                cell = new PdfPCell(new Paragraph(this.getNormalChunk(unit_value)));
                cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
                cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
                table.addCell(cell);
                cell = new PdfPCell(new Paragraph(this.getNormalChunk(total_value)));
                cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
                cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
                table.addCell(cell);
            }

            requester = "";
            title = "";
            quantity = "";
            unit_value = "";
            total_value = "";
        }

        lastQuotationId = data[0];
        requester = data[1] + "\n";
        title += data[2] + "\n";
        quantity += data[3] + "\n";
        unit_value += data[4] + "\n";
        total_value = (data[5] == null ? "-" : data[5]) + "\n";
    }

    if (!lastQuotationId.equals("0")) {
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(requester)));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(title)));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(quantity)));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(unit_value)));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(total_value)));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        table.addCell(cell);
    }
    return table;
}

From source file:biblivre3.administration.reports.ReservationReport.java

License:Open Source License

@Override
protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception {
    ReservationReportDto dto = (ReservationReportDto) reportData;
    Paragraph p1 = new Paragraph(this.getText("REPORTS_RESERVATION_TITLE"));
    p1.setAlignment(Paragraph.ALIGN_CENTER);
    document.add(p1);/*from  www.jav  a 2 s. c om*/
    document.add(new Phrase("\n\n"));
    boolean hasBiblioData = dto.getBiblioReservations() != null && !dto.getBiblioReservations().isEmpty();
    boolean hasHoldingData = dto.getHoldingReservations() != null && !dto.getHoldingReservations().isEmpty();
    if (hasBiblioData) {
        PdfPTable biblioTable = new PdfPTable(7);
        biblioTable.setWidthPercentage(100f);
        PdfPCell cell = new PdfPCell(
                new Paragraph(this.getHeaderChunk(this.getText("REPORTS_RESERVATION_BIBLIO"))));
        cell.setBackgroundColor(headerBgColor);
        cell.setBorderWidth(headerBorderWidth);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        cell.setColspan(7);
        biblioTable.addCell(cell);
        createHeader(biblioTable);
        createBody(biblioTable, dto.getBiblioReservations());
        document.add(biblioTable);
        document.add(new Phrase("\n"));
    }
    if (hasHoldingData) {
        PdfPTable holdingTable = new PdfPTable(7);
        holdingTable.setWidthPercentage(100f);
        PdfPCell cell = new PdfPCell(
                new Paragraph(this.getHeaderChunk(this.getText("REPORTS_RESERVATION_HOLDING"))));
        cell.setBackgroundColor(headerBgColor);
        cell.setBorderWidth(headerBorderWidth);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        cell.setColspan(7);
        holdingTable.addCell(cell);
        createHeader(holdingTable);
        createBody(holdingTable, dto.getHoldingReservations());
        document.add(holdingTable);
    }
    if (!hasBiblioData && !hasHoldingData) {
        PdfPTable noDataTable = new PdfPTable(1);
        noDataTable.setWidthPercentage(100f);
        String message = this.getText("REPORTS_NO_DATA") + " - " + dateFormat.format(new Date());
        PdfPCell cell = new PdfPCell(new Paragraph(this.getHeaderChunk(message)));
        cell.setBackgroundColor(headerBgColor);
        cell.setBorderWidth(headerBorderWidth);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        noDataTable.addCell(cell);
        document.add(noDataTable);
    }
}

From source file:biblivre3.administration.reports.SearchesByDateReport.java

License:Open Source License

private PdfPTable createTable(SearchesByDateReportDto dto) {
    PdfPTable table = new PdfPTable(2);
    table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
    //Table header
    PdfPCell cell;/*from   w ww .  j  a va 2s  .  c o m*/
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_DATE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_TOTAL"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setColspan(2);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    //Table body
    if (dto.getData() == null || dto.getData().isEmpty())
        return table;
    for (String[] data : dto.getData()) {
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[1])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[0])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
    }
    return table;
}

From source file:biblivre3.administration.reports.SummaryReport.java

License:Open Source License

@Override
protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception {
    SummaryReportDto dto = (SummaryReportDto) reportData;
    Paragraph p1 = new Paragraph(this.getText("REPORTS_SUMMARY_TITLE"));
    p1.setAlignment(Paragraph.ALIGN_CENTER);
    document.add(p1);//from   ww w .  j a  v  a  2s  .  c o  m
    document.add(new Phrase("\n"));
    PdfPTable table = new PdfPTable(10);
    table.setWidthPercentage(100f);
    createHeader(table);
    Collections.sort(dto.getData(), this);
    PdfPCell cell;
    for (String[] data : dto.getData()) {
        cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[6])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[0])));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[1])));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[2])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[3])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[4])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[5])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[7])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
    }
    document.add(table);
}

From source file:biblivre3.administration.reports.UserReport.java

License:Open Source License

private PdfPTable createLendingsTable(List<String[]> lendings) {
    PdfPTable table = new PdfPTable(5);
    table.setWidthPercentage(100f);/*  w  ww .  j  a v  a2  s  .  c  om*/

    PdfPCell cell;
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_DATE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_TITLE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setColspan(2);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_AUTHOR"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setColspan(2);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    for (String[] lending : lendings) {
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(lending[0])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(lending[1])));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(lending[2])));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
    }
    return table;
}

From source file:biblivre3.administration.reports.UserReport.java

License:Open Source License

private PdfPTable createUserDataTable(UserDTO user) {
    PdfPTable table = new PdfPTable(4);
    table.setWidthPercentage(100f);/* ww w.  ja  v  a  2 s  .c o  m*/
    PdfPCell cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_NAME"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getName())));
    cell.setColspan(3);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_ENROL"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(String.valueOf(user.getUserid()))));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_SIGNUP_DATE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    Date signupDate = user.getSignup_date();
    cell = new PdfPCell(
            new Paragraph(this.getNormalChunk(signupDate != null ? dateFormat.format(signupDate) : "")));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_SOCIAL_NUMBER"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getSocial_id_number())));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_ID"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getDlicense() + " " + user.getTypeId())));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_BIRTHDATE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getBirthday())));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_OBS"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getObs())));
    cell.setColspan(4);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    return table;
}

From source file:biblivre3.administration.reports.UserReport.java

License:Open Source License

private PdfPTable createAddressTable(UserDTO user) {
    PdfPTable table = new PdfPTable(4);
    table.setWidthPercentage(100f);/*from w  w w  .  j a va  2  s  .c om*/
    PdfPCell cell;

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_ADDRESS"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getAddress())));
    cell.setColspan(3);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_NUMBER"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getNumber())));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_ADDRESS_2"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getCompletion())));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_CITY"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getCity())));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_STATE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getState())));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_COUNTRY"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getCountry())));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_ZIP_CODE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getZip_code())));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_HOME_PHONE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getTelRef1())));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_MOBILE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getCellphone())));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_OFFICE_PHONE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getTelRef2())));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_EXTENSION"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getExtension_line())));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_EMAIL"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getEmail())));
    cell.setColspan(3);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    return table;
}