IText学习手册——更改ListItem前方标识
通过设置List的SymbolIndent,PreSymbol更改标识
/// <summary> /// 更改ListItem前方标识 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button18_Click(object sender, EventArgs e) { Document doc = new Document(); PdfWriter.GetInstance(doc, File.Open(path, FileMode.Create)); doc.Open(); List items = new List(List.UNORDERED); //设置为false后,可以更改标识的宽度 items.Autoindent = false; //标识宽度100 items.SymbolIndent = 100; //标识的前半部分显示内容 items.PreSymbol = "Data"; //标识后半部分显示内容 items.PostSymbol = ":"; for (var i = 0; i < 10; i++) { ListItem item = new ListItem("This is " + i + " listItem"); items.Add(item); } doc.Add(items); doc.Close(); }
显示效果: