I'm currently using iText for .pdf generation. One of my methods creates, formats and adds cells to a Table object but there are a number of cells(20-30) for this particular table, and the method itself has grown considerably.
The structure of the method is as follows:
/*create cells*/
Cell c1 = new Cell(new Paragraph("text1", textFont));
//...and so on for 20+ cells
/*format cell with custom method formatCell()*/
formatCell(c1, false);
//...and so on for 20+ cells
/*add cells to table object*/
table1.addCell(c1);
//...and so on again for 20+ cells
Is there a way where i could add the cells to the table without a stream of addCell statements?
EDIT: What I should've mentioned(apologies) is that formatCell will take a boolean parameter that will change on a per cell basis
20+iterations, and inside the loop body create a cell, format it, and add it to the table. This assumes the creation, formatting, and adding to the table can all happen at once for each cell, rather than needing to do each step to all cells at the same time as you are doing now. - ajp15243Paragraphs and forformatCell's boolean, assuming they're all potentially different for different cells. - ajp15243