How to set the row height of Paragragh in PdfPCell cells by Java Itext

in the project, you need to use java to automatically generate pdf files, and then use itext"s jar packages: iext-asian-5.2.0.jar and itextpdf-5.5.9.jar
and then reformat the text in the cell cannot set the row height:
Paragraph has setLeading () method to set the row height, but putting this Paragraph in the PdfPCell cell will not work.

< hr >
PdfPCell client_name = new PdfPCell();
        Paragraph paragraph_1 = new Paragraph(
                "",
                pdftest.ContentFont());
        paragraph_1.setLeading(20f);
        client_name = new PdfPCell(paragraph_1);
        client_name.setPaddingLeft(5.23f);
        client_name.setPaddingBottom(5);
        client_name.setPaddingTop(5);
        client_name.setBorderColor(BaseColor.WHITE);
        client_name.setVerticalAlignment(Element.ALIGN_MIDDLE);
        client_name.setBackgroundColor(tableBgColor);
        basic_info_table.addCell(client_name);

< hr >

Paragragh




Paragragh

Jul.13,2022

look at the source code and find that when the constructor creates an object, it does not get the setLeading of passing Paragraph, but directly sets the line height to (0 strong 1);

public PdfPCell(Phrase phrase) {
super(0, 0, 0, 0);
borderWidth = 0.5f;
border = BOX;
column.addText(this.phrase = phrase);
column.setLeading(0, 1);
}
< hr >

I found that PdfPCell provides a way to set row height:

< hr >
cell.setLeading(fixedLeading, multipliedLeading);
Menu