I have a problem with the library iText. I'm searching to build a nested table and apply the horizontal alignment to a column in the last table, this is my code:
PdfPTable coverTable = new PdfPTable(2);
PdfPCell containerCustomerInfo = new PdfPCell();
PdfPTable customerInfoTable = new PdfPTable(2);
customerInfoTable.setWidthPercentage(100f);
customerInfoTable.setWidths(new float[]{30f, 200f});
PdfPCell ciTitle = new PdfPCell();
ciTitle.addElement(new Chunk("Customer Info"));
ciTitle.setColspan(2);
ciTitle.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
customerInfoTable.addCell(ciTitle);
PdfPCell personLogoCell = new PdfPCell();
Image personLogo = Image.getInstance("C:/Img/personLogo.png");
personLogo.scaleAbsolute(20, 20);
personLogoCell.addElement(personLogo);
customerInfoTable.addCell(personLogoCell);
PdfPCell customerInfoCell = new PdfPCell();
customerInfoCell.addElement(new Chunk(dealerName);
customerInfoTable.addCell(customerInfoCell);
containerCustomerInfo.addElement(customerInfoTable);
coverTable.addCell(containerCustomerInfo);
coverTable.addCell("");
The problem is with the cell ciTitle which I applied the horizontal alignment to right. The string "Customer Info" is shown always to left ignoring my setting (I've tried also ALIGN_MIDDLE and ALIGN_CENTER).
Could someone help me?
Thanks
Suxper