[英]How to justify a paragraph in Itextsharp?
I have a pdfptable
with 3 columns, and a pdfpcell
(with colspan
3) , and inside this pdfpcell
I have a paragraph and I need to show it in PDF with justified
alignment . 我有一个
pdfptable
3列,并且pdfpcell
(与colspan
3),这里面pdfpcell
我有一个段落,我需要显示它与PDF justified
定位。
PdfPTable tbl = new PdfPTable(3);
tbl.WidthPercentage = 100;
string text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " +
"Maecenas diam nulla, aliquam eget porttitor sit amet, blandit quis nisi." +
"Nulla facilisi. Vestibulum eu eros elit. Nullam laoreet, elit ac tincidunt " +
"convallis, urna dui semper nisi, et imperdiet orci sem quis ante. Aliquam " +
"ut velit vitae massa aliquet malesuada. Quisque a mauris ante. Nam dolor " +
"leo, aliquam congue blandit quis, convallis non mi.";
PdfPCell cellText = new PdfPCell(new Paragraph(text,arial12blackBold));
cellText.colspan = 3; cellText.colspan = 3;
tbl.AddCell(cellText);
The font was created earlier and the document generation after this block are normal. 字体是先前创建的,此块之后的文档生成是正常的。 I only need to know how to set this paragraph or this cell to show justified-aligned the string .
我只需要知道如何设置这个段落或这个单元格来显示对齐的字符串。
PdfCell.HorizontalAlignment = Element.ALIGN_JUSTIFIED
要么
PdfCell.HorizontalAlignment = Element.ALIGN_JUSTIFIED_ALL
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.