简体   繁体   English

如何在itextsharp中设置段落行间距?

[英]How to set paragraph line space in itextsharp ?

In my C# windows Form application I use below code. 在我的C#Windows Form应用程序中,我使用以下代码。 it works fine. 它工作正常。 but I need to add line space for this paragraph. 但是我需要为该段添加行空间。

var linkFont = FontFactory.GetFont(FontFactory.HELVETICA, 13, iTextSharp.text.Font.UNDERLINE, BaseColor.BLUE);

List<Anchor> anchor = new List<Anchor>();
    foreach (string tName in templateName)
    {

    Anchor anch = new Anchor(tName, linkFont);
    anch.Reference = "#" + tName;
    anchor.Add(anch);
    }

Paragraph templateData = new Paragraph();
templateData.Alignment = Element.ALIGN_LEFT;

    for (int z = 0; z < anchor.Count; z++)
   {
      templateData.Add(anchor[z]);
      templateData.Add(" , ");
   }

output of this code is below. 此代码的输出如下。 Output of above code 上面代码的输出

if I use following code nothing changed. 如果我使用以下代码,则没有任何变化。

Paragraph templateData = new Paragraph();
templateData.Alignment = Element.ALIGN_LEFT;      
templateData .SetLeading(15, 1);  

How can I fix this issue and add line space for this paragraph ? 如何解决此问题并为此段落添加行空间?

Thanks 谢谢

更改Y值:

templateData.SetLeading(15, 10); //'1' to '10' or whatever you want

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM