Java 边缘与colspan表格itext不匹配
我已经做了 与iText的业务,我 创建了一个包含9的表 列,我已将 先是4比1,然后我有 接下来的4个组合在一起, 最后一个,最后一个 点已指定 cell.setBorderwidth=2英寸 所有单元格,以生成 文档不匹配 边缘。 希望你能帮忙 我 下面是使用的代码:Java 边缘与colspan表格itext不匹配,java,android,pdf,itext,Java,Android,Pdf,Itext,我已经做了 与iText的业务,我 创建了一个包含9的表 列,我已将 先是4比1,然后我有 接下来的4个组合在一起, 最后一个,最后一个 点已指定 cell.setBorderwidth=2英寸 所有单元格,以生成 文档不匹配 边缘。 希望你能帮忙 我 下面是使用的代码: public PdfPTable createTable5() throws DocumentException { PdfPTable table = new PdfPTable(10); table.s
public PdfPTable createTable5() throws DocumentException {
PdfPTable table = new PdfPTable(10);
table.setTotalWidth(540);
//table.setWidthPercentage(105);
table.setHorizontalAlignment(Element.ALIGN_LEFT);
table.setLockedWidth(true);
table.setWidths(new float[]{26.16f,48.77f,48.77f,48.77f,40.06f,56.64f,78.41f,53.1f,59.2f,80.11f});
PdfPCell cell;
cell = new PdfPCell(new Phrase(" ",subFont));
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setVerticalAlignment(Element.ALIGN_CENTER);
cell.setBorderWidth(0);
//cell.setBorderWidthRight(0);
//cell.setColspan(4);
table.addCell(cell);
cell = new PdfPCell(new Phrase("Cantidades por material",subFont));
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
cell.setUseAscender(true);
cell.setBorderWidth(2);
cell.setBorderWidthRight(0);
cell.setColspan(4);
cell.setFixedHeight(g);
table.addCell(cell);
cell = new PdfPCell(new Phrase("Costo por material",subFont));
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
cell.setUseAscender(true);
cell.setBorderWidth(2);
cell.setBorderWidthRight(0);
cell.setColspan(4);
cell.setFixedHeight(g);
table.addCell(cell);
cell = new PdfPCell(new Phrase("Total",subFont));// Error in Border
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
cell.setUseAscender(true);
cell.setBorderWidth(2);
//cell.setColspan(1);
cell.setFixedHeight(g);
//cell.setBorderWidthRight(0);
table.addCell(cell);
return table;
}
对每个单元格尝试设置使用边界填充(true)。仍然没有解决方案吗?