Search code examples
javaitextspring-mybatis

how will I erase or to make the border invisible of the cell that I completed using table.completeRow()


this is my code where I make an invisible border for the Merchant Column and complete the row, the Merchant column has no border, but the rest of the row had, I don't know to make it invisible.

PdfPCell cellMerchantTitle = rowCellStyle("Merchant", fontTitleSize);
cellMerchantTitle.setColspan(2);
table.addCell(cellSystemTitle);
table.completeRow();

public PdfPCell rowCellStyle(String cellValue, Font fontStyle){
PdfPCell cell = new PdfPCell(new Paragraph(cellValue, fontStyle));
cell.setHorizontalAlignment(Element.ALIGN_LEFT);
cell.setBorder(Rectangle.NO_BORDER);
return cell;
}

I already try this

table.getDefaultCell().setBorder(Rectangle.NO_BORDER);

Solution

  • Adding table.getDefaultCell().setBorder(Rectangle.NO_BORDER); should do the trick, but you have to make sure you add this line before completing the row:

    table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
    PdfPCell cellMerchantTitle = rowCellStyle("Merchant", fontTitleSize);
    cellMerchantTitle.setColspan(2);
    table.addCell(cellSystemTitle);
    table.completeRow();