Archit Shrivastava

Archit Shrivastava

  • NA
  • 416
  • 116.8k

how to hide PDF Table Border

Aug 30 2018 2:54 AM
i am creating pdf table using i textsharp.
now i dont know how to hide table border.
 here my code to generate pdf table
 
Document document = new Document(PageSize.A4, 10, 10, 10, 10);
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream("test1.pdf", FileMode.Create));
document.Open();
iTextSharp.text.Font font = new iTextSharp.text.Font();
font.Color = iTextSharp.text.BaseColor.WHITE;
PdfPTable table = new PdfPTable(3);
PdfPCell cell = new PdfPCell(new Phrase("NEW PDF", font));
cell.Colspan = 3;
cell.BackgroundColor = new iTextSharp.text.BaseColor(17, 99, 172);
cell.HorizontalAlignment = Element.ALIGN_CENTER;
table.AddCell(cell);
table.AddCell("Row 2, Col 1");
table.AddCell("Row 2, Col 1");
table.AddCell("Row 2, Col 1");
table.AddCell("Row 3, Col 1");
cell = new PdfPCell(new Phrase("Row 3, Col 2 and Col3"));
cell.Colspan = 2;
table.AddCell(cell);
cell = new PdfPCell(new Phrase("Row 4, Col 1 and Col2"));
cell.Colspan = 2;
table.AddCell(cell);
table.AddCell("Row 4, Col 3");
document.Add(table);
document.Close();

Answers (3)