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

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

Introduction

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

Prototype

public void setColspan(int colspan) 

Source Link

Document

Setter for property colspan.

Usage

From source file:com.solidmaps.webapp.report.RequerimentAlterLicenseFederalPDF.java

private void insertCellAlteracao(PdfPTable table, String text) {

    if (text == null) {
        text = "";
    }/*from  w w  w .j a va  2 s .c  om*/

    // create a new cell with the specified Text and Font
    PdfPCell cell = new PdfPCell(new Phrase(text.trim(), FONT_HEADER));
    // set the cell alignment
    // in case there is no text and you wan to create an empty row
    if (text.trim().equalsIgnoreCase("")) {
        cell.setMinimumHeight(10f);
    }

    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setColspan(2);
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);

    // add the call to the table
    table.addCell(cell);
}

From source file:com.solidmaps.webapp.report.RequerimentAlterLicenseFederalPDF.java

private void insertCellAlteracaoOption(PdfPTable table, String number, String text, Boolean selected) {

    String fullText = "";
    if (selected) {
        fullText += number + " |X|" + " " + text;
    } else {//from w  ww . ja  va 2 s  .  c o  m
        fullText += number + " |  |" + " " + text;
    }

    if (StringUtils.isBlank(number) && StringUtils.isBlank(text)) {
        fullText = "";
    }

    // create a new cell with the specified Text and Font
    PdfPCell cell = new PdfPCell(new Phrase(fullText.trim(), FONT_PARAGRAPH));
    // set the cell alignment
    // in case there is no text and you wan to create an empty row
    if (fullText.trim().equalsIgnoreCase("")) {
        cell.setMinimumHeight(10f);
    }

    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell.setColspan(2);
    cell.setBorder(Rectangle.RIGHT);
    cell.setPaddingTop(10f);
    cell.setPaddingBottom(10f);
    cell.setPaddingLeft(25f);
    cell.setPaddingRight(25f);

    // add the call to the table
    table.addCell(cell);
}

From source file:com.solidmaps.webapp.report.RequerimentAlterLicenseFederalPDF.java

private void insertHeaderCell(PdfPTable table, String text, Integer colSpan) {

    if (text == null) {
        text = "";
    }/*  ww  w  .j  a v  a  2  s.c o m*/

    // create a new cell with the specified Text and Font
    PdfPCell cell = new PdfPCell(new Phrase(text.trim(), FONT_HEADER));
    // set the cell alignment
    // in case there is no text and you wan to create an empty row
    if (text.trim().equalsIgnoreCase("")) {
        cell.setMinimumHeight(10f);
    }

    cell.setVerticalAlignment(Element.ALIGN_CENTER);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setColspan(colSpan);
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    cell.setBorderWidth(2);
    cell.setPadding(3f);

    // add the call to the table
    table.addCell(cell);
}

From source file:com.systemevent.jsfclass.util.PdfEvento.java

public PdfPTable Tabla_compleja() {
    //creamos una tabla con 3 columnas
    PdfPTable mitablacompleja = new PdfPTable(3);
    //aadimos texto con formato a la primera celda
    PdfPCell celda = new PdfPCell(new Paragraph("Historial de Observaciones", FontFactory.getFont("arial", // fuente
            22, // tamao
            Font.BOLD, // estilo
            BaseColor.RED))); // color
    //unimos esta celda con otras 2
    celda.setColspan(3);
    //alineamos el contenido al centro
    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
    // aadimos un espaciado
    celda.setPadding(12.0f);//from w  w w .j a  v  a 2  s  . c  o m
    //colocamos un color de fondo
    celda.setBackgroundColor(BaseColor.GRAY);
    //se aade a la tabla
    mitablacompleja.addCell(celda);

    //fila 2
    celda = new PdfPCell(new Paragraph("AUDITORIA DE SISTEMAS"));
    celda.setColspan(2);
    celda.setBackgroundColor(BaseColor.GREEN);
    mitablacompleja.addCell(celda);
    celda = new PdfPCell(new Paragraph("Aprobado"));
    celda.setBackgroundColor(BaseColor.LIGHT_GRAY);
    mitablacompleja.addCell(celda);
    //fila 3        
    celda = new PdfPCell(new Paragraph("COMPILADORES"));
    celda.setColspan(2);
    celda.setBackgroundColor(BaseColor.YELLOW);
    mitablacompleja.addCell(celda);
    celda = new PdfPCell(new Paragraph("Reprobado"));
    celda.setBackgroundColor(BaseColor.LIGHT_GRAY);
    mitablacompleja.addCell(celda);
    //fila 4        
    celda = new PdfPCell(new Paragraph("Prog. Bajo Nivel"));
    celda.setColspan(2);
    celda.setBackgroundColor(BaseColor.CYAN);
    mitablacompleja.addCell(celda);
    celda = new PdfPCell(new Paragraph("Eximido"));
    celda.setBackgroundColor(BaseColor.LIGHT_GRAY);
    mitablacompleja.addCell(celda);
    //fila 5
    mitablacompleja.addCell("Conclusion");
    celda = new PdfPCell(new Paragraph("GET A LIFE!!!"));
    celda.setHorizontalAlignment(Element.ALIGN_RIGHT);
    celda.setColspan(2);
    celda.setBackgroundColor(BaseColor.ORANGE);
    mitablacompleja.addCell(celda);
    // se retorna la tabla

    return mitablacompleja;
}

From source file:com.tomasz.drag.triballocommanderro.controller.MakerPDF.java

public static PdfPTable createTable(Person person, EventGig event) throws DocumentException, IOException {
    int a = 0;// w w w.  ja v  a2  s  . c om
    if (person.getZaladunekScenaDachWyplata() > 0) {
        a++;
    }
    if (person.getZaladunekTechnikiWyplata() > 0) {
        a++;
    }

    if (person.getMontazDachuWyplata() > 0) {
        a++;
    }
    if (person.getMontazDzwiekuWyplata() > 0) {
        a++;
    }

    if (person.getMontazScenyWyplata() > 0) {
        a++;
    }
    if (person.getMontazSwiatlaWyplata() > 0) {
        a++;
    }

    if (person.getMontazTechnikiWyplata() > 0) {
        a++;
    }

    if (person.getDemontazDachuWyplata() > 0) {
        a++;
    }
    if (person.getDemontazDzwiekuWyplata() > 0) {
        a++;
    }

    if (person.getDemontazScenyWyplata() > 0) {
        a++;
    }
    if (person.getDemontazSwiatlaWyplata() > 0) {
        a++;
    }

    if (person.getDemontazTechnikiWyplata() > 0) {
        a++;
    }

    if (person.getRozladunekScenaDachWyplata() > 0) {
        a++;
    }
    if (person.getRozladunekTechnikiWyplata() > 0) {
        a++;
    }
    if (person.getDyzurWyplata() > 0) {
        a++;
    }
    if (person.getTechnikScenyWyplata() > 0) {
        a++;
    }
    if (person.getRealizacjaFOHWyplata() > 0) {
        a++;
    }
    if (person.getRealizacjaMONWyplata() > 0) {
        a++;
    }
    if (person.getRealizacjaSwiatlaWyplata() > 0) {
        a++;
    }

    if (person.getPremia() > 0) {
        a++;
    }

    System.out.println(a);
    BaseFont bf;
    bf = BaseFont.createFont("src\\main\\resources\\font\\arialuni.ttf", BaseFont.IDENTITY_H,
            BaseFont.EMBEDDED);
    // bf = BaseFont.createFont("arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
    com.itextpdf.text.Font ft = new com.itextpdf.text.Font(bf);
    PdfPTable table = new PdfPTable(2);
    table.setTotalWidth(new float[] { 90, 190 });
    table.setLockedWidth(true);
    PdfPCell cell;
    cell = new PdfPCell(new Phrase(person.getName() + " " + person.getSurName(), ft));
    cell.setColspan(1);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase(event.getName() + " " + event.getData(), ft));
    cell.setColspan(2);
    table.addCell(cell);
    cell = new PdfPCell(new Phrase(""));

    cell.setRowspan(a);

    table.addCell(cell);

    if (person.getZaladunekScenaDachWyplata() > 0) {
        table.addCell(new Phrase("Zaadunek Scena/Dach", ft));

    }
    if (person.getZaladunekTechnikiWyplata() > 0) {
        table.addCell(new Phrase("Zaadunek Techniki", ft));
    }

    if (person.getMontazDachuWyplata() > 0) {
        table.addCell(new Phrase("Monta Dachu", ft));

    }
    if (person.getMontazDzwiekuWyplata() > 0) {
        table.addCell(new Phrase("Monta Dwieku", ft));
    }

    if (person.getMontazScenyWyplata() > 0) {
        table.addCell(new Phrase("Monta Sceny", ft));

    }
    if (person.getMontazSwiatlaWyplata() > 0) {
        table.addCell(new Phrase("Monta wiata", ft));
    }

    if (person.getMontazTechnikiWyplata() > 0) {
        table.addCell(new Phrase("Monta Techniki", ft));
    }

    if (person.getDemontazDachuWyplata() > 0) {
        table.addCell(new Phrase("Demonta Dachu", ft));

    }
    if (person.getDemontazDzwiekuWyplata() > 0) {
        table.addCell(new Phrase("Demonta Dwieku", ft));
    }

    if (person.getDemontazScenyWyplata() > 0) {
        table.addCell(new Phrase("Demonta Sceny", ft));

    }
    if (person.getDemontazSwiatlaWyplata() > 0) {
        table.addCell(new Phrase("Demonta wiata", ft));
    }

    if (person.getDemontazTechnikiWyplata() > 0) {
        table.addCell(new Phrase("Demonta Techniki", ft));
    }

    if (person.getRozladunekScenaDachWyplata() > 0) {
        table.addCell(new Phrase("Rozadunek Scena/Dach", ft));

    }
    if (person.getRozladunekTechnikiWyplata() > 0) {
        table.addCell(new Phrase("Rozadunek Techniki", ft));
    }

    if (person.getDyzurWyplata() > 0) {
        table.addCell(new Phrase("Dyur", ft));
    }

    if (person.getTechnikScenyWyplata() > 0) {
        table.addCell(new Phrase("Technik Sceny", ft));
    }

    if (person.getRealizacjaFOHWyplata() > 0) {
        table.addCell(new Phrase("Realizacja FOH", ft));
    }

    if (person.getRealizacjaMONWyplata() > 0) {
        table.addCell(new Phrase("Realizacja MON", ft));
    }

    if (person.getRealizacjaSwiatlaWyplata() > 0) {
        table.addCell(new Phrase("Realizacja wiata", ft));
    }

    if (person.getPremia() > 0) {
        table.addCell(new Phrase("Premia", ft));
    }

    cell = new PdfPCell(new Phrase("Suma: "));
    cell.setColspan(1);
    table.addCell(cell);
    //cell = new PdfPCell(new Phrase(Double.toString(person.getSumaWyplata())));//String.format("%.2f", tempPerson.getRealizacjaSwiatlaWyplata())
    cell = new PdfPCell(new Phrase(String.format("%.2f", person.getSumaWyplata()) + " z", ft));//String.format("%.2f", tempPerson.getRealizacjaSwiatlaWyplata())
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(" "));
    cell.setColspan(1);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);
    //cell = new PdfPCell(new Phrase(Double.toString(person.getSumaWyplata())));//String.format("%.2f", tempPerson.getRealizacjaSwiatlaWyplata())
    cell = new PdfPCell(new Phrase("  "));//String.format("%.2f", tempPerson.getRealizacjaSwiatlaWyplata())
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);
    table.setBreakPoints(2 + a);

    return table;

}

From source file:com.vectorprint.report.itext.style.stylers.ColRowSpan.java

License:Open Source License

@Override
public <E> E style(E text, Object data) throws VectorPrintException {
    PdfPCell cell = (PdfPCell) text;

    cell.setColspan(getValue(COLSPAN_PARAM, Integer.class));
    cell.setRowspan(getValue(ROWSPAN_PARAM, Integer.class));

    return text;//from w w  w  .jav  a 2 s. c  o m
}

From source file:com.wabacus.system.component.application.report.abstractreport.AbsReportType.java

License:Open Source License

protected void showTitleOnPdf() throws Exception {
    PdfPTable tableTitle = new PdfPTable(1);
    tableTitle.setTotalWidth(pdfwidth);/*w w  w.  j  a v  a2s.c o m*/
    tableTitle.setLockedWidth(true);//
    int titlefontsize = 0;
    if (this.pdfbean != null)
        titlefontsize = this.pdfbean.getTitlefontsize();
    if (titlefontsize <= 0)
        titlefontsize = 10;
    Font headFont = new Font(PdfAssistant.getInstance().getBfChinese(), titlefontsize, Font.BOLD);
    PdfPCell cell = new PdfPCell(
            new Paragraph(rbean.getTitle(rrequest) + "  " + rbean.getSubtitle(rrequest), headFont));
    cell.setColspan(1);
    cell.setBorder(0);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    tableTitle.addCell(cell);
    document.add(tableTitle);
}

From source file:com.wabacus.system.component.application.report.abstractreport.AbsReportType.java

License:Open Source License

protected void addDataHeaderCell(Object configbean, String value, int rowspan, int colspan, int align) {
    if (dataheadFont == null) {
        int dataheaderfontsize = 0;
        if (this.pdfbean != null)
            dataheaderfontsize = this.pdfbean.getDataheaderfontsize();
        if (dataheaderfontsize <= 0)
            dataheaderfontsize = 6;/*  www. jav  a  2 s.c  om*/
        dataheadFont = new Font(PdfAssistant.getInstance().getBfChinese(), dataheaderfontsize, Font.BOLD);//??
    }
    PdfPCell cell = new PdfPCell(new Paragraph(value, dataheadFont));
    cell.setColspan(colspan);
    cell.setRowspan(rowspan);
    //            cell.setImage(img);
    //        cell.addElement(new Paragraph(value+"2222",dataheadFont));
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    cell.setHorizontalAlignment(align);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    if (pdfbean != null && pdfbean.getInterceptorObj() != null) {
        pdfbean.getInterceptorObj().displayPerColDataWithoutTemplate(this, configbean, -1, value, cell);
    }
    pdfDataTable.addCell(cell);
}

From source file:com.wabacus.system.component.application.report.abstractreport.AbsReportType.java

License:Open Source License

protected void addDataCell(Object configbean, String value, int rowspan, int colspan, int align) {
    if (dataFont == null) {
        int datafontsize = 0;
        if (this.pdfbean != null)
            datafontsize = this.pdfbean.getDatafontsize();
        if (datafontsize <= 0)
            datafontsize = 6;//  w  w w .  j  a va  2s .co  m
        dataFont = new Font(PdfAssistant.getInstance().getBfChinese(), datafontsize, Font.NORMAL);
    }
    PdfPCell cell = new PdfPCell(new Paragraph(value, dataFont));
    cell.setColspan(colspan);//??
    cell.setRowspan(rowspan);
    //        }catch(Exception e)
    cell.setHorizontalAlignment(align);//??
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    if (pdfbean != null && pdfbean.getInterceptorObj() != null) {
        pdfbean.getInterceptorObj().displayPerColDataWithoutTemplate(this, configbean, rowspan, value, cell);
    }
    pdfDataTable.addCell(cell);
}

From source file:comisionesafis.informes.LiquidacionComisiones.java

private void printResumenContable(PdfPTable tabla, Double total, String codAgente) {

    ResultSet rsAgente;//from  w  w  w .  j  a  v a  2  s  .  c om
    Statement stmt;
    String sSQL = "";
    Double retencion;
    Double liquido;
    String patron = "dd/MM/yyyy";
    SimpleDateFormat formato = new SimpleDateFormat(patron);
    String fecha = (formato.format(new Date()));
    String cuenta;

    try {
        // SELECT para extraer todos los cdigos de los agentes con Recibos
        sSQL = "SELECT * ";
        sSQL += "  FROM Agentes";
        sSQL += " WHERE CodAgente ='" + codAgente + "'";
        stmt = conexion.createStatement();
        rsAgente = stmt.executeQuery(sSQL);

        PdfPCell celda;
        Font font;

        // Primera fila de datos
        font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);
        celda = new PdfPCell(new Phrase(" ", font));
        celda.setColspan(3);
        celda.setBorder(Rectangle.TOP);
        tabla.addCell(celda);

        font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);
        celda = new PdfPCell(new Phrase("TOTAL ", font));
        celda.setBorder(Rectangle.TOP);
        celda.setHorizontalAlignment(Element.ALIGN_LEFT);
        tabla.addCell(celda);

        font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);
        celda = new PdfPCell(new Phrase(Numeros.formateaDosDecimales(total), font));
        celda.setBorder(Rectangle.TOP);
        celda.setHorizontalAlignment(Element.ALIGN_RIGHT);
        tabla.addCell(celda);

        // Segunda fila de datos
        font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);
        celda = new PdfPCell(new Phrase(" ", font));
        celda.setColspan(3);
        celda.setBorder(Rectangle.NO_BORDER);
        tabla.addCell(celda);

        font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);
        celda = new PdfPCell(new Phrase("I.R.P.F. " + rsAgente.getString("RetencionPorcentaje") + "%", font));
        celda.setBorder(Rectangle.NO_BORDER);
        celda.setHorizontalAlignment(Element.ALIGN_LEFT);
        tabla.addCell(celda);

        retencion = total * (Double.parseDouble(rsAgente.getString("RetencionPorcentaje")) / 100);
        font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);
        celda = new PdfPCell(new Phrase(Numeros.formateaDosDecimales(retencion), font));
        celda.setBorder(Rectangle.NO_BORDER);
        celda.setHorizontalAlignment(Element.ALIGN_RIGHT);
        tabla.addCell(celda);

        // Tercera fila de datos
        font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);
        celda = new PdfPCell(new Phrase(" ", font));
        celda.setColspan(3);
        celda.setBorder(Rectangle.BOTTOM);
        tabla.addCell(celda);

        font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);
        celda = new PdfPCell(new Phrase("L?QUIDO ", font));
        celda.setBorder(Rectangle.BOTTOM);
        celda.setHorizontalAlignment(Element.ALIGN_LEFT);
        tabla.addCell(celda);

        liquido = total - retencion;
        font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);
        celda = new PdfPCell(new Phrase(Numeros.formateaDosDecimales(liquido), font));
        celda.setBorder(Rectangle.BOTTOM);
        celda.setHorizontalAlignment(Element.ALIGN_RIGHT);
        tabla.addCell(celda);

        // Cuenta
        cuenta = rsAgente.getString("Banco") + " ";
        cuenta += rsAgente.getString("Sucursal") + " ";
        cuenta += rsAgente.getString("DC") + " ";
        cuenta += rsAgente.getString("Cuenta") + " ";

        font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);
        celda = new PdfPCell(new Phrase("CTA n " + cuenta, font));
        celda.setColspan(5);
        celda.setBorder(Rectangle.NO_BORDER);
        tabla.addCell(celda);

        // Firma
        font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);
        celda = new PdfPCell(new Phrase("En Madrid a " + fecha, font));
        celda.setColspan(5);
        celda.setBorder(Rectangle.NO_BORDER);
        tabla.addCell(celda);

        font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);
        celda = new PdfPCell(new Phrase("V.Bo. ", font));
        celda.setColspan(5);
        celda.setBorder(Rectangle.NO_BORDER);
        tabla.addCell(celda);

        font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);
        celda = new PdfPCell(new Phrase(" ", font));
        celda.setColspan(5);
        celda.setBorder(Rectangle.NO_BORDER);
        tabla.addCell(celda);

        font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);
        celda = new PdfPCell(new Phrase(" ", font));
        celda.setColspan(5);
        celda.setBorder(Rectangle.NO_BORDER);
        tabla.addCell(celda);

        font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);
        celda = new PdfPCell(new Phrase("PELAYO VIDA", font));
        celda.setColspan(5);
        celda.setBorder(Rectangle.NO_BORDER);
        tabla.addCell(celda);

    } catch (Exception e) {
        System.out.println(e.getMessage());
    }

}