开发者

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

开发者 https://www.devze.com 2023-02-21 13:02 出处:网络
I\'m creating a PDF document and inside of it i\'m creating a table. I want some cells to have bold text style.

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 thi开发者_JAVA技巧s be done?


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

0

精彩评论

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