第iTextSharp的下一行未来右下方的序列号 [英] Itextsharp Next line in paragraph coming right below serial number

查看:186
本文介绍了第iTextSharp的下一行未来右下方的序列号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用iTextSharp的生成PDF。我给一个序列号后,在页面上写一些笔记。我使用段落。但在第下一行来到有权根据序列号。我如何定义边距或填充到款,只有当它进入到下一行?

I am working on generating PDF using iTextSharp. I have some notes to be written on the page after giving a serial number. I am using Paragraph. But next line in paragraph comes right under serial number. How can I define margins or padding to paragraph only if it goes to next line?

我的code

for(int i=0;i<list.count;i++)
{
    doc.Add(new Paragraph(String.Format("{0}) {1} ({2}).", (i + 1).ToString(), "Here Goes My String", "Date Time"), font));
}

I 是序列号。

推荐答案

而添加列表项款,创造iTextSharp的清单项目,并把它添加到的ListItem数组列表。您可以创建有序和Unorder列表项,类似于HTML对应&LT; UL&GT; &LT; OL&GT;

Rather adding your list items to paragraph, create List items of itextsharp and add it to Arraylist of listItem. You can create Ordered and Unorder list item, similar to HTML counterpart <ul> and <ol>

检查低于code:

  iTextSharp.text.List list = new iTextSharp.text.List(iTextSharp.text.List.ORDERED, 20f);
  list.IndentationLeft = 20f;//indented 20 points from left margin
  list.Add("The RomanList is added to the ordered list, and iTextSharp indents the RomanList relative to the ordered list to which it belongs");
  list.Add("The RomanList is added to the ordered list, and iTextSharp indents the RomanList relative to the ordered list to which it belongs");
  list.Add("Three");
  pdfDoc.Add(list);//add list to document

以上code将创建有序列表。第二个参数设置symbolIndent到20分,这导致对数与项目本身之间的空间。

Above code will create ordered list. Second argument sets symbolIndent to 20 points, this results in to the space between number and the item itself.

要了解更多关于iTextSharp的创建列表,请访问以下链接:

To know more about creating lists with Itextsharp, check out below link:

http://www.mikesdotnetting.com/Article/83/Lists-与-iTextSharp的

这篇关于第iTextSharp的下一行未来右下方的序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆