我有一个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;
tbl.AddCell(cellText);
字体是先前创建的,此块之后的文档生成是正常的。我只需要知道如何设置这个段落或这个单元格来显示对齐的字符串。
答案 0 :(得分:3)
PdfCell.HorizontalAlignment = Element.ALIGN_JUSTIFIED
或
PdfCell.HorizontalAlignment = Element.ALIGN_JUSTIFIED_ALL