开发者

iTextSharp - How to add a PDFPRow to a PDFPTable?

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 f开发者_如何学Cind 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜