iTextSharp - 如何将PDFPRow添加到PDFPTable? [英] iTextSharp - How to add a PDFPRow to a PDFPTable?

查看:648
本文介绍了iTextSharp - 如何将PDFPRow添加到PDFPTable?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一个PDFPCell数组添加到PDFPRow中,然后将PDFPRow添加到PDFPTable中,但我似乎无法在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 find a method within PDFPTable for this.

然而有一个PDFPTable.AddCell

There is however a PDFPTable.AddCell

任何想法?

推荐答案

查看 PdfPTable Rows.Add()方法,该方法采用PdfPRow,你可以使用 PdfPCells 数组构造。

Check out the PdfPTable's Rows.Add() method which takes a PdfPRow, which you can construct using an array of PdfPCells.

示例:

// ...
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);
// ...

方法 GetCell() 返回 PdfPCell

这篇关于iTextSharp - 如何将PDFPRow添加到PDFPTable?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆