【发布时间】:2015-06-23 14:30:21
【问题描述】:
来自this,我认为我可以通过执行以下操作之一来增加段落间距:
par.SetLeading(15, 2.5f); // doesn't do anything
par.SetLeading(0, 2); // doesn't do anything
在上下文中:
Chunk boldpart = new Chunk("Important: ", helvetica9BoldRed);
Chunk ini = new Chunk("Form must be filled out in ", helvetica9Red);
Anchor anchor = new Anchor("Adobe Reader", LinkFont);
anchor.Reference = "http://www.adobe.com";
Chunk middlePart = new Chunk(" or Acrobat Professional 8.1 or above. To save completed forms, Acrobat Professional is required. For technical and accessibility assistance, contact the ", helvetica9Red);
Anchor anchorCCO = new Anchor("Campus Controller's Office", LinkFont);
anchor.Reference = "mailto:dplatypus@ucsc.edu";
PdfPTable tbl = new PdfPTable(1);
tbl.WidthPercentage = 55;
tbl.HorizontalAlignment = Element.ALIGN_LEFT;
var par = new Paragraph();
//par.SetLeading(15, 2.5f); // doesn't do anything
par.SetLeading(0, 2); // doesn't do anything
par.Add(boldpart);
par.Add(ini);
par.Add(anchor);
par.Add(middlePart);
par.Add(anchorCCO);
PdfPCell chunky = new PdfPCell(par);
chunky.BorderWidth = PdfPCell.NO_BORDER;
tbl.AddCell(chunky);
doc.Add(tbl);
正如 cmets 所指出的,两者都不做任何事情。这是我看到的:
如何增加段落中的行间距?
更新
当我尝试这样做时(响应答案):
PdfPCell chunky = new PdfPCell();
chunky.AddCell(par);
我明白了,“'iTextSharp.text.pdf.PdfPCell' 不包含'AddCell' 的定义,并且没有扩展方法'AddCell' 接受'iTextSharp.text.pdf.PdfPCell' 类型的第一个参数可以找到"
【问题讨论】:
-
AddCell- 我认为它只是Add。 -
原来是AddElement()
-
;) 好的,几乎正确...
标签: pdf-generation itextsharp paragraph