List of usage examples for com.itextpdf.text.pdf PdfPTable setWidthPercentage
public void setWidthPercentage(final float widthPercentage)
From source file:com.devox.GUI.PDF.CrearReporteApto.java
@Override public PdfPTable crearTabla() { PdfPTable table = new PdfPTable(8); //new float[]{2.4f, 3f, 1.25f, 1.2f, 1f, 1.15f, 1.1f, 1.55f} PdfPCell cell;/*from ww w. java2 s . c om*/ cell = new PdfPCell(new Phrase("CDIGO", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorRight(GRIS_CLARO); cell.setFixedHeight(20f); table.addCell(cell); cell = new PdfPCell(new Phrase("DESCRIPCIN", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("LOTE", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("FECHA DE CADUCIDAD", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CANTIDAD", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("DICTAMEN", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(AMARILLO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("PRECIO", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(AMARILLO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("OBSERVACIONES", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(AMARILLO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); try { table.setWidths(new float[] { 2.4f, 3f, 1.25f, 1.2f, 1f, 1.15f, 1.1f, 1.55f }); table.setWidthPercentage(100); } catch (DocumentException ex) { Log.print(ex); } return table; }
From source file:com.devox.GUI.PDF.CrearReporteDestruccion.java
@Override public PdfPTable configurarInformacion() { PdfPTable table = new PdfPTable(2); try {/*w w w . ja v a2 s . com*/ PdfPCell cell; Phrase folio = new Phrase(); folio.add(new Chunk("FOLIO DHL ", FUENTE_FOLIO_CHICA)); folio.add(new Chunk(contenido.getFolioDHL(), FUENTE_FOLIO_CHICA_ROJA)); cell = new PdfPCell(folio); cell.setRowspan(8); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("Cliente ", contenido.getNombreCliente())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("Nmero de cliente ", contenido.getClaveCliente())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("Folio del cliente ", contenido.getFolioCliente())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("Folio Abbott ", contenido.getFolioAbbott())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("Motivo de devolucin ", contenido.getMotivo().getCodigo() + " - " + contenido.getMotivo().getDescripcion())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("Factura ", contenido.getFactura())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("Almacn ", contenido.getAlmacen())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell( getPhraseFromChunks("Fecha de captura ", Funciones.getOtherDate(contenido.getFechaCaptura()))); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); table.setWidthPercentage(100); table.setWidths(new int[] { 1, 3 }); } catch (DocumentException ex) { Log.print(ex); } return table; }
From source file:com.devox.GUI.PDF.CrearReporteDestruccion.java
@Override public PdfPTable crearTabla() { PdfPTable table = new PdfPTable(6); PdfPCell cell;/*from w w w . ja va 2 s . co m*/ cell = new PdfPCell(new Phrase("DESCRIPCIN", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorRight(GRIS_CLARO); cell.setFixedHeight(20f); table.addCell(cell); cell = new PdfPCell(new Phrase("LOTE", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CDIGO", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CANTIDAD", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("PRECIO UNITARIO", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("SUBTOTAL", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(AMARILLO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); try { table.setWidths(new float[] { 5f, 2f, 3f, 1.2f, 1.4f, 1.5f }); table.setWidthPercentage(98); } catch (DocumentException ex) { Log.print(ex); } return table; }
From source file:com.devox.GUI.PDF.CrearReportePorEstado.java
@Override public PdfPTable configurarInformacion() { PdfPTable table = new PdfPTable(2); PdfPCell cell;/*w ww.ja va 2 s. c o m*/ cell = new PdfPCell(getPhraseFromChunks("DEL ", fechaInicio)); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("AL ", fechaFin)); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); table.setWidthPercentage(100); return table; }
From source file:com.devox.GUI.PDF.CrearReporteTarimas.java
@Override public PdfPTable configurarInformacion() { PdfPTable table = new PdfPTable(2); try {//from w ww . j av a 2s . c o m PdfPCell cell; Phrase tarima = new Phrase(); tarima.add(new Chunk("TARIMA\n", FUENTE_TARIMA_NEGRO)); tarima.add(new Chunk(datosTarima.getNombreTarima(), FUENTE_TARIMA_ROJO)); cell = new PdfPCell(tarima); cell.setRowspan(5); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); cell.setFixedHeight(200f); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("DIVISIN ", datosTarima.getDivision())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("ALMACN ", datosTarima.getAlmacen())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("FECHA DE APERTURA ", Funciones.getOtherDate(datosTarima.getFecha_Apertura()))); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("FECHA DE CIERRE ", (datosTarima.getFecha_Cierra() == null ? "TARIMA ABIERTA" : Funciones.getOtherDate(datosTarima.getFecha_Cierra())))); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("DESTRUCCIN FISCAL ", Integer.toString(datosTarima.getDestruccionFiscal()))); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); table.setWidthPercentage(100); table.setWidths(new int[] { 2, 1 }); } catch (DocumentException de) { Log.print(de); } return table; }
From source file:com.devox.GUI.PDF.CrearReporteTarimas.java
@Override public PdfPTable crearTabla() { PdfPTable table = new PdfPTable(4); PdfPCell cell;//from w w w . ja va 2s.c om cell = new PdfPCell(new Phrase("FOLIO DHL", FUENTE_CABECERA_TABLA_MEDIANA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorRight(GRIS_CLARO); cell.setFixedHeight(20f); table.addCell(cell); cell = new PdfPCell(new Phrase("PRODUCTO (Descripcin)", FUENTE_CABECERA_TABLA_MEDIANA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CDIGO INTERNO", FUENTE_CABECERA_TABLA_MEDIANA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CANTIDAD", FUENTE_CABECERA_TABLA_MEDIANA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); try { table.setWidths(new float[] { 1f, 1.5f, 2.5f, 1f }); table.setWidthPercentage(100); } catch (DocumentException ex) { Log.print(ex); } return table; }
From source file:com.devox.GUI.PDF.ExportarAPDF.java
private static PdfPTable setUpInformation() { PdfPTable table = new PdfPTable(2); try {//from www .j ava 2s . co m PdfPCell cell; Phrase folio = new Phrase(); folio.add(new Chunk("FOLIO DHL ", font_foliodhl)); folio.add(new Chunk(contenido.getFolioDHL(), font_folionum)); cell = new PdfPCell(folio); cell.setRowspan(8); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("Cliente ", contenido.getNombreCliente())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("Nmero de cliente ", contenido.getClaveCliente())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("Folio del cliente ", contenido.getFolioCliente())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("Folio Abbott ", contenido.getFolioAbbott())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("Motivo de devolucin ", contenido.getMotivo().getCodigo() + " - " + contenido.getMotivo().getDescripcion())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("Factura ", contenido.getFactura())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("Almacn ", contenido.getAlmacen())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell( getPhraseFromChunks("Fecha de captura ", Funciones.getOtherDate(contenido.getFechaCaptura()))); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); table.setWidthPercentage(100); table.setWidths(new int[] { 1, 3 }); } catch (DocumentException ex) { Log.print(ex); Log.print(ex); } return table; }
From source file:com.devox.GUI.PDF.ExportarAPDF.java
private static PdfPTable createTable() { PdfPTable table = new PdfPTable(6); PdfPCell cell;//from w w w . j a va 2 s. c om cell = new PdfPCell(new Phrase("DESCRIPCIN", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorRight(GRIS_CLARO); cell.setFixedHeight(20f); table.addCell(cell); cell = new PdfPCell(new Phrase("LOTE", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CDIGO", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CANTIDAD", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("PRECIO UNITARIO", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("SUBTOTAL", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(AMARILLO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); try { table.setWidths(new float[] { 5f, 2f, 3f, 1.2f, 1.4f, 1.5f }); table.setWidthPercentage(98); } catch (DocumentException ex) { Log.print(ex); Log.print(ex); } return table; }
From source file:com.devox.GUI.PDF.ExportarAPDF.java
private PdfPTable setUpInformationTarimas() { PdfPTable table = new PdfPTable(2); try {//from w ww . ja v a 2 s . c o m PdfPCell cell; Phrase tarima = new Phrase(); tarima.add(new Chunk("TARIMA\n", font_tarimota)); tarima.add(new Chunk(datosTarima.getNombreTarima(), font_tarimota_gris)); cell = new PdfPCell(tarima); cell.setRowspan(5); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); cell.setFixedHeight(200f); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("DIVISIN ", datosTarima.getDivision())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("ALMACN ", datosTarima.getAlmacen())); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("FECHA DE APERTURA ", Funciones.getOtherDate(datosTarima.getFecha_Apertura()))); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell( getPhraseFromChunks("FECHA DE CIERRE ", Funciones.getOtherDate(datosTarima.getFecha_Cierra()))); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); cell = new PdfPCell(getPhraseFromChunks("DESTRUCCIN FISCAL ", Integer.toString(datosTarima.getDestruccionFiscal()))); cell.setBorder(PdfPCell.NO_BORDER); cell.setPaddingLeft(40); table.addCell(cell); table.setWidthPercentage(100); table.setWidths(new int[] { 2, 1 }); } catch (DocumentException de) { Log.print(de); } return table; }
From source file:com.devox.GUI.PDF.ExportarAPDF.java
private PdfPTable createTableTarimas() { PdfPTable table = new PdfPTable(4); PdfPCell cell;// w w w . j a v a 2 s .c o m cell = new PdfPCell(new Phrase("FOLIO DHL", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorRight(GRIS_CLARO); cell.setFixedHeight(20f); table.addCell(cell); cell = new PdfPCell(new Phrase("PRODUCTO (Descripcin)", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CDIGO INTERNO", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CANTIDAD", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); try { table.setWidths(new float[] { 1f, 1.5f, 2.5f, 1f }); table.setWidthPercentage(100); } catch (DocumentException ex) { Log.print(ex); Log.print(ex); } return table; }