I am creating a document in Itext and have it broken down into 4 main Cell which have tables nested within them. I am creating the last cell of my document and cannot get anything but the first cell in every row to show up.
Here is the function I'm calling which is returning a cell that I am adding to my main document.
public PdfPCell getPSBioCell() {
PdfPCell spaceCell = new PdfPCell(new Phrase(""));
spaceCell.setColspan(1); // space
spaceCell.setBorder(0);
PdfPTable table = new PdfPTable(4);
PdfPCell main = new PdfPCell();
noBorder(main);//
main.setPadding(0);//
PdfPCell dist = new PdfPCell(new Phrase(_rangerDistrict, nf));
PdfPCell district = new PdfPCell(new Phrase(this.sale.getRangerDistrict(), nf));
PdfPCell saleD = new PdfPCell(new Phrase(_saleDate, nf));
PdfPCell saleDate = new PdfPCell(new Phrase(this.formatDateString(sale.getSaleDate()), nf));
PdfPCell awardD = new PdfPCell(new Phrase(_awardDate, nf));
PdfPCell awardDate = new PdfPCell(new Phrase(this.formatDateString(sale.getAwardDate()), nf));
PdfPCell termD = new PdfPCell(new Phrase(_termDate, nf));
PdfPCell termDate = new PdfPCell(new Phrase(this.formatDateString(sale.getTerminationDate()), nf));
PdfPCell avg = new PdfPCell(new Phrase(_avgDbh , nf));
PdfPCell avgDbh = new PdfPCell(new Phrase(this.formatNumberString(String.valueOf(sale.getAveDiam())), nf));
PdfPCell cruis = new PdfPCell(new Phrase(_cruiser, nf));
PdfPCell cruiser = new PdfPCell(new Phrase(sale.getCruiser(), nf));
noBorder(dist, district, saleD, saleDate);
noBorder(awardD, awardDate, termD, termDate, avg);
noBorder(avgDbh, cruis, cruiser);
//
table.addCell(dist);
table.addCell(district);
table.addCell(spaceCell);
table.addCell(spaceCell);
//
table.addCell(saleD);
table.addCell(saleDate);
table.addCell(spaceCell);
table.addCell(spaceCell);
//
table.addCell(awardD);
table.addCell(awardDate);
table.addCell(spaceCell);
table.addCell(spaceCell);
//
table.addCell(termD);
table.addCell(termDate);
table.addCell(spaceCell);
table.addCell(spaceCell);
//
table.addCell(avg);
table.addCell(avgDbh);
table.addCell(spaceCell);
table.addCell(spaceCell);
//
table.addCell(cruis);
table.addCell(cruiser);
table.addCell(spaceCell);
table.addCell(spaceCell);
table.setWidthPercentage(100);
main.addElement(table);
return main;
}
这里的问题是在我的noBorder(PdfPcell)
函数中,我正在执行cell.setBorder(0)
但我也在执行cell.noWrap(true)
所以将边框设置为0
并将 noWrap 设置为true
我看不到其他单元格被推离完成的 Pdf 页面。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.