1

我有一个pdfptable3 列和一个pdfpcell(with colspan3) ,在这里面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);

字体是较早创建的,此块之后的文档生成是正常的。我只需要知道如何设置此段落或此单元格以显示对齐的字符串。

4

1 回答 1

3
PdfCell.HorizontalAlignment = Element.ALIGN_JUSTIFIED

或者

PdfCell.HorizontalAlignment = Element.ALIGN_JUSTIFIED_ALL
于 2013-04-30T20:06:36.183 回答