Código PHP:
/**
* Crea tabla de informacion
* @return Tabla
*/
public PdfPTable getTablaInfo() throws DocumentException {
PdfPTable datatable = new PdfPTable(8);
datatable.setSpacingBefore(10f);
//int headerwidths[] = {12, 9, 10, 15, 11,13, 11, 15 };
int headerwidths[] = {11, 8, 9, 9, 13,13, 11, 15 };
datatable.setWidths(headerwidths);
datatable.setWidthPercentage(100);
datatable.getDefaultCell().setPadding(5);
datatable.getDefaultCell().setBorderWidth(1);
/***headers table****/
datatable.addCell(getCell(ttlConsec,FUENTE_NUM1,Color.LIGHT_GRAY));
datatable.addCell(getCell(ttlTienda,FUENTE_NUM1,Color.LIGHT_GRAY));
datatable.addCell(getCell(ttlFechaSin,FUENTE_NUM1,Color.LIGHT_GRAY));
datatable.addCell(getCell(ttlFechaX,FUENTE_NUM1,Color.LIGHT_GRAY));
datatable.addCell(getCell(ttlFolio,FUENTE_NUM1,Color.LIGHT_GRAY));
datatable.addCell(getCell(ttlImporteTotRecla,FUENTE_NUM1,Color.LIGHT_GRAY));
datatable.addCell(getCell(ttlImporteTotRec,FUENTE_NUM1,Color.LIGHT_GRAY));
datatable.addCell(getCell(ttlObservaciones,FUENTE_NUM1,Color.LIGHT_GRAY));
/***end headers table****/
/***info table****/
for (int i =0;i<=2;i++){
datatable.addCell(getCell("1",FUENTE_NUM1,Element.ALIGN_CENTER,Element.ALIGN_TOP));
datatable.addCell(getCell("2",FUENTE_NUM1,Element.ALIGN_CENTER,Element.ALIGN_TOP));
datatable.addCell(getCell("3",FUENTE_NUM1,Element.ALIGN_CENTER,Element.ALIGN_TOP));
datatable.addCell(getCell("4",FUENTE_NUM1,Element.ALIGN_CENTER,Element.ALIGN_TOP));
datatable.addCell(getCell("5",FUENTE_NUM1,Element.ALIGN_CENTER,Element.ALIGN_TOP));
datatable.addCell(getCell("6",FUENTE_NUM1,Element.ALIGN_CENTER,Element.ALIGN_TOP));
datatable.addCell(getCell("7",FUENTE_NUM1,Element.ALIGN_CENTER,Element.ALIGN_TOP));
datatable.addCell(getCell("8",FUENTE_NUM1,Element.ALIGN_CENTER,Element.ALIGN_TOP));
}
/***end info table****/
/***total table****/
datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
datatable.getDefaultCell().setVerticalAlignment(Element.ALIGN_BOTTOM);
datatable.getDefaultCell().setColspan(5);
PdfPCell cel = new PdfPCell(new Paragraph(ttlTotal.getText(),FUENTE_NUM1));
cel.setBorderWidth(1);
cel.setHorizontalAlignment(Element.ALIGN_RIGHT);
cel.setVerticalAlignment(Element.ALIGN_BOTTOM);
cel.setColspan(5);
datatable.addCell(cel);
// datatable.getDefaultCell().setColspan(1);
// datatable.addCell(cel);
datatable.getDefaultCell().setRowspan(2);
// datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_BOTTOM);
PdfPTable table = new PdfPTable(3);
int headerw[] = {13, 11, 15 };
table.setWidths(headerw);
table.getDefaultCell().setBorderWidth(1);
table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_BASELINE);
//table.getDefaultCell().setRowspan(2);
table.addCell(getCell("row1",FUENTE_NUM2,Element.ALIGN_RIGHT,Element.ALIGN_BOTTOM,2));
table.addCell(getCell("row2",FUENTE_NUM2,Element.ALIGN_RIGHT,Element.ALIGN_BOTTOM,2));
table.addCell(getCell("row3",FUENTE_NUM2,Element.ALIGN_RIGHT,Element.ALIGN_BOTTOM));
table.addCell(getCell("row4",FUENTE_NUM2,Element.ALIGN_RIGHT,Element.ALIGN_BOTTOM));
table.addCell(getCell("row5",FUENTE_NUM2,Element.ALIGN_RIGHT,Element.ALIGN_BOTTOM));
table.addCell(getCell("row6",FUENTE_NUM2,Element.ALIGN_RIGHT,Element.ALIGN_BOTTOM));
PdfPCell cell = new PdfPCell(table);
cell.setColspan(3);
datatable.addCell(cell);
/***end total table****/
return datatable;
}