user590586
user590586

Reputation: 3050

How to make the text inside a specific cell of a table bold in PDF using Java?

I'm creating a PDF document and inside of it i'm creating a table.

I want some cells to have bold text style.

How can this be done?

Upvotes: 0

Views: 2420

Answers (1)

Sangeet Menon
Sangeet Menon

Reputation: 9905

Before adding text to the cell, Create a new paragraph with the text you want to add.

Paragraph paragraph=new Paragraph("Test in the Cell");

paragraph.getFont().setStyle(Font.BOLD);

Cell c=new Cell(paragraph);

table.addCell(c);

For those Cells in which you need not want the bold just simply remove the line paragraph.getFont().setStyle(Font.BOLD);

Upvotes: 3

Related Questions