What is the PdfPTable.DefaultCell property used for?

一笑奈何 提交于 2019-11-29 17:25:36

When creating a PdfPTable, you add cells.

One way is to create a PdfPCell object and to add that cell with the addCell() method.

Another way is to use a short-cut: you don't create a PdfPCell, but you add a String or a Phrase to the table with the addCell() method. In this case, a PdfPCell is created internally using default properties. You can change the default properties by changing the properties of the default cell. The default cell is obtained using the getDefaultCell() method.

This is what the Javadoc information is about: this default PdfPCell will be used as reference for all the addCell() methods except addCell(PdfPCell). (Because when adding a PdfPCell, the properties of that PdfPCell will be used, not the properties of the default cell.)

This is explained in Chapter 4 of my book "iText in Action - Second Edition".

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!