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?
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
.