writeText(cb, drItem["itemId"].ToString(), left_margin, top_margin, f_cn, 10);
writeText(cb, "LOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOO
NNNNNNNNNNNN NNNNNNNNNNNNNNNNNNNNNNNNN NNNNNNNNNNNNNNNNNNNNNNNNNNNN
GGGGGGGGGGGGG GGGGGGGGGGGGGGGG TEXT, left_margin + 70, top_margin, f_cn, 10);
writeText(cb, drItem["itemDate"].ToString(), left_margin + 300, top_margin, f_cn, 10);
cb.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, drItem["invoicedQuantity"].ToString(), left_margin + 400, top_margin, 0);
writeText(cb, drItem["unit"].ToString(), left_margin + 410, top_margin, f_cn, 10);
cb.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, drItem["price"].ToString(), left_margin + 480, top_margin, 0);
writeText(cb, drItem["currency"].ToString(), left_margin + 490, top_margin, f_cn, 10);
写文本方法就像:
private void writeText(PdfContentByte cb, string text, int x, int y, BaseFont font, int size)
{
cb.SetFontAndSize(font, size);
cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, text, x, y, 0);
}
但问题是“长文”太长了。如何在60个字符后添加断行?
我正在使用iTextSharp,我不知道。我尝试使用Chunk
和Phrase
但不能正常工作