In my report generation java application with iText 7, I need to get data from a large data tables which may extend to several pages.
My code segments to generate the table.
Table table = new Table(new float[] {0.4f, 1f, 1f, 1f, 1.3f, 1f, 1.3f, 0.6f,0.6f,1.2f}, true)
.setWidth(UnitValue.createPercentValue(100))
.setMarginTop(tblTopMargin)
.setMarginBottom(0);
int count = 0;
while (!dataList.empty()) {
String[] dataRow = dataList.poll();
createDataRow(dataRow, table);
count++;
if(count % 10 == 0) {
table.flush();
}
}
implementation of createDataRaw
method is mentioned below,
private void createDataRow(String[] a, Table table) {
for (String s : a) {
Paragraph content = new Paragraph(s)
.setFontSize(7)
.setFixedLeading(9)
.setFontColor(new DeviceCmyk(0, 0, 0, 100));
Cell cell = new Cell()
.setBorder(new SolidBorder(ColorConstants.BLACK, 0.5f))
.setPaddingLeft(2)
.setPaddingTop(0)
.setPaddingBottom(0)
.setHorizontalAlignment(HorizontalAlignment.LEFT)
.setVerticalAlignment(VerticalAlignment.MIDDLE)
.add(content);
table.addCell(cell);
}
}
with the given code table generated with all the data. But when there is a page break between tables then the bottom line of the table is not showing except for the last table bottom.
screenshots are attached here to get a more clear idea.
Can someone help me to solve this issue?