itext7 错误

Errors with itext7

我正在尝试将一些 "multiple rows and columns" 的单元格添加到 table,但是
IndexOutOfBoundsException.

任何帮助将不胜感激。

谢谢!

public static void main(String[] args) throws FileNotFoundException {
    PdfWriter writer = new PdfWriter("D:\test.pdf");
    PdfDocument pdf = new PdfDocument(writer);
    Document document = new Document(pdf);
    Table table = new Table(10);
    table.setWidthPercent(100);
    table.addCell(new Cell(1, 3).add(new Paragraph(1 + "_" + 3 + "_")));
    table.addCell(new Cell(1, 7).add(new Paragraph(1 + "_" + 4 + "_")));
    table.addCell(new Cell(6, 1).add(new Paragraph(6 + "_" + 1 + "_")));
    table.addCell(new Cell(6, 9).add(new Paragraph(6 + "_" + 9 + "_")));
    table.flushContent();
    document.add(table);
    document.close();
}

异常

java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at com.itextpdf.layout.renderer.TableRenderer.drawVerticalBorder(TableRenderer.java:1718)
at com.itextpdf.layout.renderer.TableRenderer.drawBorders(TableRenderer.java:1619)    
at com.itextpdf.layout.renderer.TableRenderer.drawChildren(TableRenderer.java:1265)
at com.itextpdf.layout.renderer.AbstractRenderer.draw(AbstractRenderer.java:437)
at com.itextpdf.layout.renderer.TableRenderer.draw(TableRenderer.java:1175)
at com.itextpdf.layout.renderer.DocumentRenderer.flushSingleRenderer(DocumentRenderer.java:118)
at com.itextpdf.layout.renderer.RootRenderer.processRenderer(RootRenderer.java:287)
at com.itextpdf.layout.renderer.RootRenderer.updateCurrentAreaAndProcessRenderer(RootRenderer.java:300)
at com.itextpdf.layout.renderer.RootRenderer.addChild(RootRenderer.java:201)
at com.itextpdf.layout.RootElement.add(RootElement.java:108)
at com.itextpdf.layout.Document.add(Document.java:143)

该错误已在 7.0.3-SNAPSHOT 中修复。可以从 Artifactory.

下载修复的快照

生成的文件现在如下所示: