如何在itext中跳过新行字符?

如何在itext中跳过新行字符?,itext,Itext,如果新行字符已经存在,如何跳过它 在我的情况下,如果数据库中的文本采用以下格式: Relative to the ground, an airplane gains speed when it encounters wind from behind. 因此,我必须在pdftable列中的一行中写入尽可能多的可用空间。为了实现这一点,您必须将setNoWrap()设置为true。 试试这样的 Phrase p1=new Phrase("Relative to the ground, an a

如果新行字符已经存在,如何跳过它

在我的情况下,如果数据库中的文本采用以下格式:

Relative to the ground, an airplane 
gains speed when it encounters wind 
from behind.

因此,我必须在pdftable列中的一行中写入尽可能多的可用空间。

为了实现这一点,您必须将
setNoWrap()
设置为true。 试试这样的

Phrase p1=new Phrase("Relative to the ground, an airplane gains speed when it encounters wind from behind.", FontFactory.getFont(FontFactory.TIMES_ROMAN,8));
PdfPCell cell1=new PdfPCell(p1);
cell1.setNoWrap(true);
还要注意,如果列大小小于,则文本将超过单元格