What is the PdfPTable.DefaultCell property used for?

The Java documentation for PdfPTable.getDefaultCell() reads:

Gets the default PdfPCell that will be used as reference for all the addCell methods except addCell(PdfPCell).

I don't understand this.

Posted on StackOverflow on Jun 3, 2014 by Water Cooler v2

If you use iText 7, you'll find some changes in creating tables. PdfPTable and PdfPCell don't exist anymore, we use Table and Cell.

You should use addCell() method to add any type of content you want (String, Image, BlockElement or Cell itself) and set different properties directly to it. The getDefaultCell() method doesn't exist.

If you want to see how to answer this question in iText 5, follow this link.

Ready to use iText?

Try our iText 7 Library and add-ons FREE for 30 days. Test your proof of concept, and see if our solution is right for you.

Get my FREE trial

Still have questions? 

We're happy to answer your questions. Reach out to us and we'll get back to you shortly.

Contact us
Stay updated

Join 11,000+ subscribers and become an iText PDF expert by staying up to date with our new products, updates, tips, technical solutions and happenings.

Subscribe Now