Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/392.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Java在PDF中使表的特定单元格中的文本加粗?_Java_Pdf_Pdf Generation_Itext - Fatal编程技术网

如何使用Java在PDF中使表的特定单元格中的文本加粗?

如何使用Java在PDF中使表的特定单元格中的文本加粗?,java,pdf,pdf-generation,itext,Java,Pdf,Pdf Generation,Itext,我正在创建一个PDF文档,并在其中创建一个表 我希望某些单元格具有粗体文本样式 如何做到这一点?在将文本添加到单元格之前,请使用要添加的文本创建一个新段落 Paragraph paragraph=new Paragraph("Test in the Cell"); paragraph.getFont().setStyle(Font.BOLD); Cell c=new Cell(paragraph); table.addCell(c); 对于那些不需要粗体的单元格,只需删除该行即可 段落.

我正在创建一个PDF文档,并在其中创建一个表

我希望某些单元格具有粗体文本样式


如何做到这一点?

在将文本添加到单元格之前,请使用要添加的文本创建一个新段落

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

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

Cell c=new Cell(paragraph);

table.addCell(c);
对于那些不需要粗体的单元格,只需删除该行即可
段落.getFont().setStyle(Font.BOLD)

在将文本添加到单元格之前,使用要添加的文本创建一个新段落

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

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

Cell c=new Cell(paragraph);

table.addCell(c);
对于那些不需要粗体的单元格,只需删除该行即可
段落.getFont().setStyle(Font.BOLD)