Example usage for com.itextpdf.text.pdf PdfPTable getDefaultCell

List of usage examples for com.itextpdf.text.pdf PdfPTable getDefaultCell

Introduction

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

Prototype

public PdfPCell getDefaultCell() 

Source Link

Document

Gets the default PdfPCell that will be used as reference for all the addCell methods except addCell(PdfPCell).

Usage

From source file:edu.uc.modulocontable.general.GenerarKardexPDF.java

private void cabeceraTabla() throws DocumentException {
    PdfPTable tablePanelInicial = new PdfPTable(4);
    tablePanelInicial.setWidthPercentage(100);
    tablePanelInicial.setWidths(new int[] { 28, 15, 15, 15 });
    tablePanelInicial.getDefaultCell().setBorder(5);
    tablePanelInicial.setHorizontalAlignment(2);

    PdfPCell cell = new PdfPCell(new Paragraph("", FontFactory.getFont("arial", 10, Font.BOLD)));
    cell.setHorizontalAlignment(1);/* w ww.  j a  v a 2  s  .co  m*/
    cell.setBorder(0);
    tablePanelInicial.addCell(cell);

    cell = new PdfPCell(new Paragraph("Entrada", FontFactory.getFont("arial", 10, Font.BOLD)));
    cell.setHorizontalAlignment(1);
    tablePanelInicial.addCell(cell);

    cell = new PdfPCell(new Paragraph("Salida", FontFactory.getFont("arial", 10, Font.BOLD)));
    cell.setHorizontalAlignment(1);
    tablePanelInicial.addCell(cell);

    cell = new PdfPCell(new Paragraph("Saldo", FontFactory.getFont("arial", 10, Font.BOLD)));
    cell.setHorizontalAlignment(1);
    tablePanelInicial.addCell(cell);

    documento.add(tablePanelInicial);
}

From source file:edu.uc.modulocontable.general.GenerarKardexPDF.java

private void comprobarLIFO() throws DocumentException {

    PdfPTable tablePanelInicial = new PdfPTable(1);
    tablePanelInicial.setWidthPercentage(100);
    tablePanelInicial.getDefaultCell().setBorder(0);
    tablePanelInicial.setHorizontalAlignment(2);

    PdfPCell cell = new PdfPCell(new Paragraph("Comprobacin", FontFactory.getFont("arial", 10, Font.BOLD)));
    cell.setHorizontalAlignment(2);//from w w  w .  ja v  a  2  s .  com
    cell.setBorder(0);
    tablePanelInicial.addCell(cell);

    documento.add(espacioBlanco.getElemento());
    documento.add(espacioBlanco.getElemento());

    documento.add(tablePanelInicial);

    documento.add(espacioBlanco.getElemento());
    tablaVertical.limpiar();
    int[] alineamientos = { 0, 2 };
    int[] tamanos = { 20, 17 };
    Vector datos = new Vector();
    Vector<String> titulos = new Vector<String>();
    datos.add(0);
    titulos.add("Inv. inicial");
    datos.add(getCantidadEntrada());
    titulos.add("(+) U. entrada");
    datos.add(getCantidadSalida());
    titulos.add("(-) U. salida");
    datos.add(getSaldoCantidad());
    titulos.add("(=) Stock");

    String[] anArray = new String[titulos.size()];
    tablaVertical.setTitulos(titulos.toArray(anArray));
    tablaVertical.setContenidos(datos.toArray());
    tablaVertical.setAlineamientos(alineamientos);
    tablaVertical.llenarTabla(true);
    tablaVertical.setPosicion(2);
    tablaVertical.setAnchoTabla(42);
    tablaVertical.setTamanos(tamanos);

    documento.add(tablaVertical.getTabla());
}

From source file:edu.uc.modulocontable.general.GenerarLibroDiarioPDF.java

private void cabecera() throws DocumentException {
    Archivo a = new Archivo();
    Empresa empresa = a.obtieneContenidoArchivo().get(0);

    PdfPTable tablePanelInicial = new PdfPTable(2);
    tablePanelInicial.setWidthPercentage(100);
    tablePanelInicial.getDefaultCell().setBorder(0);

    PdfPTable tablePanelIzquierdo = new PdfPTable(1);
    tablePanelIzquierdo.setWidthPercentage(50);
    tablePanelIzquierdo.getDefaultCell().setBorder(0);

    PdfPTable tablePanelDerecho = new PdfPTable(1);
    tablePanelDerecho.setWidthPercentage(100);
    tablePanelDerecho.getDefaultCell().setBorder(0);

    titulo1.setTexto(empresa.getNombre());
    tablePanelIzquierdo.addCell(titulo1.getElemento());

    imagen.setDir("/Users/cuent/Downloads/abc-logo.jpg");
    tablePanelIzquierdo.addCell(imagen.getImage());

    tablePanelInicial.addCell(tablePanelIzquierdo);

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    titulo2.setTexto("Libro Diario");
    titulo2.getElementoRojo();//from  w  ww  . j  a v  a2  s  .com
    tablePanelDerecho.addCell(titulo2.getElemento());

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    tablaVertical.limpiar();
    int[] alineamientos = { 0, 0, 0, 0 };
    Object[] datos = { empresa.getRuc(), empresa.getDireccion(), empresa.getTelefono(), "2005", "1" };
    tablaVertical.setTitulos("RUC:", "Direccin:", "Tlefono:", "Periodo", "# Diario");
    tablaVertical.setContenidos(datos);
    tablaVertical.setAlineamientos(alineamientos);
    tablaVertical.llenarTabla(false);
    tablaVertical.setPosicion(0);
    tablaVertical.setAnchoTabla(65);
    tablePanelDerecho.addCell(tablaVertical.getTabla());

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    tablePanelInicial.addCell(tablePanelDerecho);
    documento.add(tablePanelInicial);
}

From source file:edu.uc.modulocontable.general.pdf.Cabezera.java

public void addHeaderTable(Document document) throws DocumentException {
    PdfPTable tablePanelInicial = new PdfPTable(2);
    tablePanelInicial.setWidthPercentage(100);

    PdfPTable tablePanelIzquierdo = new PdfPTable(1);
    tablePanelIzquierdo.setWidthPercentage(100);
    tablePanelIzquierdo.getDefaultCell().setBorder(0);

    PdfPTable tablePanelDerecho = new PdfPTable(1);
    tablePanelDerecho.setWidthPercentage(100);
    tablePanelDerecho.getDefaultCell().setBorder(0);

    titulo2.getElementoNegro();/*from  w w  w  .jav  a  2 s. co  m*/
    titulo3.getElementoNegro();

    imagen.setDir("C:\\Users\\Juan Pablo\\Pictures\\emp.png");
    tablePanelIzquierdo.addCell(imagen.getImage());

    titulo2.getElementoVerde();
    titulo2.setTexto("Empresa ABC");

    tablePanelIzquierdo.addCell(titulo2.getElemento(2));

    titulo1.setTexto("RUC: " + "01059512710001");
    tablePanelDerecho.addCell(titulo1.getElemento());

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    titulo2.setTexto("FACTURA");
    titulo2.getElementoRojo();
    tablePanelDerecho.addCell(titulo2.getElemento());

    titulo2.setTexto("No.: " + cabezeraFactura.getEstablecimiento() + "-" + cabezeraFactura.getPtoEmision()
            + "-" + cabezeraFactura.getNumeroFactura());
    titulo2.getElementoRojo();
    tablePanelDerecho.addCell(titulo2.getElemento());

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    tablaVertical.limpiar(1);
    int[] tamanos2 = { 50 };
    int[] alineamientos = { 0, 0 };
    tablaVertical.setTamanos(tamanos2);
    tablaVertical.setTitulos("Nmero de Autorizacin:");
    Object[] datos10 = { cabezeraFactura.getAutorizacionSri() };
    tablaVertical.setContenidos(datos10);
    tablaVertical.setAlineamientos(alineamientos);
    tablaVertical.llenarTabla(false);
    tablaVertical.setPosicion(0);
    tablaVertical.setAnchoTabla(65);
    tablePanelDerecho.addCell(tablaVertical.getTabla());

    tablaVertical.limpiar();
    Object[] datos3 = { cabezeraFactura.getFecha().toString() };
    tablaVertical.setTitulos("Fecha y Hora de Autorizacin: ");
    tablaVertical.setContenidos(datos3);
    tablaVertical.llenarTabla(false);
    tablaVertical.setPosicion(0);
    tablaVertical.setAnchoTabla(65);
    tablePanelDerecho.addCell(tablaVertical.getTabla());

    document.add(tablePanelInicial);
    document.add(espacioBlanco.getElemento());

}

From source file:edu.uc.modulocontable.transaccion.GenerarComprobacion.java

private void cabecera() throws DocumentException {
    Archivo a = new Archivo();
    Empresa empresa = a.obtieneContenidoArchivo().get(0);

    PdfPTable tablePanelInicial = new PdfPTable(2);
    tablePanelInicial.setWidthPercentage(100);
    tablePanelInicial.getDefaultCell().setBorder(0);

    PdfPTable tablePanelIzquierdo = new PdfPTable(1);
    tablePanelIzquierdo.setWidthPercentage(50);
    tablePanelIzquierdo.getDefaultCell().setBorder(0);

    PdfPTable tablePanelDerecho = new PdfPTable(1);
    tablePanelDerecho.setWidthPercentage(100);
    tablePanelDerecho.getDefaultCell().setBorder(0);

    titulo1.setTexto(empresa.getNombre());
    tablePanelIzquierdo.addCell(titulo1.getElemento());

    imagen.setDir("/Users/cuent/Downloads/abc-log.jpg");
    tablePanelIzquierdo.addCell(imagen.getImage());

    tablePanelInicial.addCell(tablePanelIzquierdo);

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    titulo2.setTexto("BALANCE DE COMPROBACIN");
    titulo2.getElementoRojo();/*ww  w.j av  a 2  s  .  com*/
    tablePanelDerecho.addCell(titulo2.getElemento());

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    tablePanelInicial.addCell(tablePanelDerecho);
    documento.add(tablePanelInicial);
}

From source file:edu.uc.modulocontable.transaccion.GenerarComprobacion.java

private void cabeceraTabla() throws DocumentException {
    PdfPTable tablePanelInicial = new PdfPTable(5);
    tablePanelInicial.setWidthPercentage(100);
    tablePanelInicial.setWidths(new int[] { 10, 5, 5, 5, 5 });
    tablePanelInicial.getDefaultCell().setBorder(5);
    tablePanelInicial.setHorizontalAlignment(2);

    PdfPCell cell = new PdfPCell(new Paragraph("", FontFactory.getFont("arial", 10, Font.BOLD)));
    cell.setHorizontalAlignment(1);/*from   w w  w.  jav a  2s. c o  m*/
    cell.setBorder(0);
    tablePanelInicial.addCell(cell);

    cell = new PdfPCell(new Paragraph("Suma", FontFactory.getFont("arial", 10, Font.BOLD)));
    cell.setHorizontalAlignment(1);
    tablePanelInicial.addCell(cell);

    cell = new PdfPCell(new Paragraph("Saldos", FontFactory.getFont("arial", 10, Font.BOLD)));
    cell.setHorizontalAlignment(1);
    tablePanelInicial.addCell(cell);

    documento.add(tablePanelInicial);
}

From source file:edu.uc.modulocontable.transaccion.GenerarGeneral.java

private void cabecera() throws DocumentException {
    Archivo a = new Archivo();
    Empresa empresa = a.obtieneContenidoArchivo().get(0);

    PdfPTable tablePanelInicial = new PdfPTable(2);
    tablePanelInicial.setWidthPercentage(100);
    tablePanelInicial.getDefaultCell().setBorder(0);

    PdfPTable tablePanelIzquierdo = new PdfPTable(1);
    tablePanelIzquierdo.setWidthPercentage(50);
    tablePanelIzquierdo.getDefaultCell().setBorder(0);

    PdfPTable tablePanelDerecho = new PdfPTable(1);
    tablePanelDerecho.setWidthPercentage(100);
    tablePanelDerecho.getDefaultCell().setBorder(0);

    titulo1.setTexto(empresa.getNombre());
    tablePanelIzquierdo.addCell(titulo1.getElemento());

    imagen.setDir("/Users/cuent/Downloads/abc-log.jpg");
    tablePanelIzquierdo.addCell(imagen.getImage());

    tablePanelInicial.addCell(tablePanelIzquierdo);

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    titulo2.setTexto("BALANCE GENERAL");
    titulo2.getElementoRojo();//from  ww w.  ja v a 2s.c om
    tablePanelDerecho.addCell(titulo2.getElemento());

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    tablePanelInicial.addCell(tablePanelDerecho);
    documento.add(tablePanelInicial);
}

From source file:edu.uc.modulocontable.transaccion.GenerarLibroDiario.java

private void cabecera() throws DocumentException {
    Archivo a = new Archivo();
    Empresa empresa = a.obtieneContenidoArchivo().get(0);

    PdfPTable tablePanelInicial = new PdfPTable(2);
    tablePanelInicial.setWidthPercentage(100);
    tablePanelInicial.getDefaultCell().setBorder(0);

    PdfPTable tablePanelIzquierdo = new PdfPTable(1);
    tablePanelIzquierdo.setWidthPercentage(50);
    tablePanelIzquierdo.getDefaultCell().setBorder(0);

    PdfPTable tablePanelDerecho = new PdfPTable(1);
    tablePanelDerecho.setWidthPercentage(100);
    tablePanelDerecho.getDefaultCell().setBorder(0);

    titulo1.setTexto(empresa.getNombre());
    tablePanelIzquierdo.addCell(titulo1.getElemento());

    imagen.setDir("/Users/cuent/Downloads/abc-log.jpg");
    tablePanelIzquierdo.addCell(imagen.getImage());

    tablePanelInicial.addCell(tablePanelIzquierdo);

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    titulo2.setTexto("LIBRO DIARIO");
    titulo2.getElementoRojo();//ww  w  . j  a  v  a2  s. c o m
    tablePanelDerecho.addCell(titulo2.getElemento());

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    tablePanelInicial.addCell(tablePanelDerecho);
    documento.add(tablePanelInicial);
}

From source file:edu.uc.modulocontable.transaccion.GenerarLibroMayor.java

private void cabecera() throws DocumentException {
    Archivo a = new Archivo();
    Empresa empresa = a.obtieneContenidoArchivo().get(0);

    PdfPTable tablePanelInicial = new PdfPTable(2);
    tablePanelInicial.setWidthPercentage(100);
    tablePanelInicial.getDefaultCell().setBorder(0);

    PdfPTable tablePanelIzquierdo = new PdfPTable(1);
    tablePanelIzquierdo.setWidthPercentage(50);
    tablePanelIzquierdo.getDefaultCell().setBorder(0);

    PdfPTable tablePanelDerecho = new PdfPTable(1);
    tablePanelDerecho.setWidthPercentage(100);
    tablePanelDerecho.getDefaultCell().setBorder(0);

    titulo1.setTexto(empresa.getNombre());
    tablePanelIzquierdo.addCell(titulo1.getElemento());

    imagen.setDir("/Users/cuent/Downloads/abc-log.jpg");
    tablePanelIzquierdo.addCell(imagen.getImage());

    tablePanelInicial.addCell(tablePanelIzquierdo);

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    titulo2.setTexto("LIBRO MAYOR");
    titulo2.getElementoRojo();/*from  w  w w .  j av a 2s . c  om*/
    tablePanelDerecho.addCell(titulo2.getElemento());

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    tablePanelInicial.addCell(tablePanelDerecho);
    documento.add(tablePanelInicial);
}

From source file:edu.uc.modulocontable.transaccion.GenerarResultados.java

private void cabecera() throws DocumentException {
    Archivo a = new Archivo();
    Empresa empresa = a.obtieneContenidoArchivo().get(0);

    PdfPTable tablePanelInicial = new PdfPTable(2);
    tablePanelInicial.setWidthPercentage(100);
    tablePanelInicial.getDefaultCell().setBorder(0);

    PdfPTable tablePanelIzquierdo = new PdfPTable(1);
    tablePanelIzquierdo.setWidthPercentage(50);
    tablePanelIzquierdo.getDefaultCell().setBorder(0);

    PdfPTable tablePanelDerecho = new PdfPTable(1);
    tablePanelDerecho.setWidthPercentage(100);
    tablePanelDerecho.getDefaultCell().setBorder(0);

    titulo1.setTexto(empresa.getNombre());
    tablePanelIzquierdo.addCell(titulo1.getElemento());

    imagen.setDir("/Users/cuent/Downloads/abc-log.jpg");
    tablePanelIzquierdo.addCell(imagen.getImage());

    tablePanelInicial.addCell(tablePanelIzquierdo);

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    titulo2.setTexto("ESTADO DE RESULTADOS");
    titulo2.getElementoRojo();/*w w  w  .  ja  v a2s . c om*/
    tablePanelDerecho.addCell(titulo2.getElemento());

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    tablePanelDerecho.addCell(espacioBlanco.getElemento());

    tablePanelInicial.addCell(tablePanelDerecho);
    documento.add(tablePanelInicial);
}