I would like to add an array of PDFPCells to a PDFPRow, then add the PDFPRow to a PDFPTable, but I can't seem to find a method within PDFPTable for this.
There is however a PDFPTable.AddCell
Any ideas?
Check out the PdfPTable
's Rows.Add()
method which takes a PdfPRow, which you can construct using an array of PdfPCells
.
Example:
// ...
PdfPTable table = new PdfPTable(5);
PdfPCell[] cells = new PdfPCell[] { new PdfPCell(GetCell("c1")),
new PdfPCell(GetCell("c2")),
new PdfPCell(GetCell("c3")),
new PdfPCell(GetCell("c4")),
new PdfPCell(GetCell("c5"))};
PdfPRow row = new PdfPRow(cells);
table.Rows.Add(row);
// ...
Where the method GetCell()
returns a PdfPCell
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With