itext7嵌套表无法在单元格中嵌套表

时间:2019-08-12 14:27:48

标签: java

我的单元格中需要嵌套表格,但是有一些间距,因此无法自动布局列?

这是一个itext7.1.7,编写实现了一个特殊的表。

 Cell c_cell = new  Cell(1,3).setFont(font).setBorderTop(Border.NO_BORDER);
    Table table = new Table(3);
    table.setWidth(UnitValue.createPercentValue(100));


    Cell c_test1 = new  Cell().setFont(font);
    c_test1.add(new Paragraph().add(new Text(dataLabel).setFontSize(8)));

    Cell c_test2 = new  Cell().setFont(font);
    Cell c_test3 = new  Cell().setFont(font);
    c_test3.add(new Paragraph().add(new Text(dataLabel).setFontSize(8)));
    Cell c_test4 = new  Cell().setFont(font);
    c_test4.add(new Paragraph().add(new Text(dataLabel).setFontSize(8)));
    table.addCell(c_test1);
    table.addCell(c_test2);
    table.addCell(c_test3);
    table.addCell(c_test4);
    table.setFixedLayout();

    table.useAllAvailableWidth();
    c_cell.add(table).setPadding(0f);
    itemTable.addCell(c_cell);

我希望单元格中的嵌套表自动布局不会在单元格内留出空间。

enter image description here

0 个答案:

没有答案