【发布时间】:2018-03-14 09:11:05
【问题描述】:
我正在使用 iTEXT 和 java 创建一个简单的 PDF,其中包含特定形式的表格。 我在 PDF 文件中的表格形状应该是这样的
编辑: 我尝试在代码中使用行跨度
cell1.setRowspan(2);
cell1.setVerticalAlignment(Element.ALIGN_MIDDLE);
cell1.setPaddingTop(-13);
cell1.setPaddingBottom(10);
PdfPCell cell2 = new PdfPCell(new Phrase("Cell 2"));
cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
cell2.setPaddingTop(-13);
cell2.setPaddingBottom(10);
PdfPCell cell3 = new PdfPCell(new Phrase("Cell 2"));
cell3.setVerticalAlignment(Element.ALIGN_MIDDLE);
cell3.setPaddingTop(-13);
cell3.setPaddingBottom(10);
//cell.setBorder(Rectangle.NO_BORDER);
Paragraph p= new Paragraph("توفة توفايات",arabic);
Paragraph p2= new Paragraph("سناء علاء حسين",arabic);
Paragraph p3= new Paragraph("سناء سءء~ حسين",arabic);
p.setAlignment(PdfPCell.ALIGN_LEFT);
p2.setAlignment(PdfPCell.ALIGN_LEFT);
cell1.addElement(p);
cell2.addElement(p2);
table.addCell(cell1);
table.addCell(cell2);
table.completeRow();
事实上,我不知道我是否以正确的方式处理行跨度,因为我的 PDF 仅显示 p 和 p2,p3 在 PDF 中没有。
我该怎么做?
【问题讨论】:
-
你应该分享你已经尝试过的东西。 StackOverflow 旨在帮助彼此解决问题。而不是外包开发。