I am designing a table in pdf using itextsharp. I want to ask if anyone knows:
- How to give border (like color = silver, 1px, fit to width) to header text?
- How to make table fit to page width (like 100%)?
I am using vb.net
Protected Sub Create_Pdf_Click(sender As Object, e As EventArgs) Handles Create_Pdf.Click
Dim pdfDoc As New Document()
Dim pdfWrite As PdfWriter = PdfWriter.GetInstance(pdfDoc, New FileStream("D://PDF/myfile.pdf", FileMode.Create))
pdfDoc.Open()
pdfDoc.Add(New Paragraph("Here is header text"))
Dim table As New PdfPTable(3)
Dim cell As New PdfPCell(New Phrase("Header spanning 3 columns"))
cell.Colspan = 3
cell.HorizontalAlignment = 1
table.AddCell(cell)
table.AddCell("Col 1 Row 1")
table.AddCell("Col 2 Row 1")
table.AddCell("Col 3 Row 1")
table.AddCell("Col 1 Row 2")
table.AddCell("Col 2 Row 2")
table.AddCell("Col 3 Row 2")
pdfDoc.Add(table)
pdfDoc.Close()
End Sub