C# 添加到PdfCell后保留列表缩进

C# 添加到PdfCell后保留列表缩进,c#,winforms,itextsharp,C#,Winforms,Itextsharp,我正在pdfcell中添加列表。但此列表的标识不正确。 它是这样来的: • One • Two • Three 但如果直接添加到文档中,相同的列表将正确显示标识。如下所示: • One • Two • Three 代码如下: list = new List(false, 14.4F); list.ListSymbol = new Chunk("\u2022", FontFactory.GetFont(FontFactory.HELVETICA, 10,iTextSharp.text

我正在pdfcell中添加列表。但此列表的标识不正确。 它是这样来的:

• One 
• Two
• Three
但如果直接添加到文档中,相同的列表将正确显示标识。如下所示:

• One 
   • Two
• Three
代码如下:

list = new List(false, 14.4F);
list.ListSymbol = new Chunk("\u2022", FontFactory.GetFont(FontFactory.HELVETICA, 10,iTextSharp.text.Font.BOLD));
ListItem listItem;
listItem = new ListItem(lstrBullets.Trim(), FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.NORMAL));
list.IndentationLeft = lftBulletIndent;    
listItem.SetLeading(10.0F, 1.0F);
listItem.Alignment = Element.ALIGN_JUSTIFIED;
list.Add(listItem);
PdfCell cell = new PdfCell();
cell.AddElement(list);
pobjTable.AddCell(cell);

其中lftBulletIndent给出了列表的缩进值。请帮助我这里缺少的内容。如何将缩进保留在单元格中?

这就是我解决此问题的方法。我知道这不是一个合适的方法。但它对我很有效。
我正在父表的第一个单元格中添加一个宽度可变的表,即这里的pobjTable

PdfPTable DummyTable = new PdfPTable(2);
//Here the floatSpace value changes according to the lftBulletIndent values
float[] headerwidths = { 2f + floatSpace, 98f - floatSpace};
DummyTable.SetWidths(headerwidths);

Pcell = new PdfPCell();
Pcell.Border = Rectangle.NO_BORDER;
DummyTable.AddCell(Pcell);


Pcell = new PdfPCell();
Pcell.AddElement(list);
Pcell.Border = Rectangle.NO_BORDER;
DummyTable.AddCell(Pcell);

pobjTable.AddCell(DummyTable);//Inserting a new table here
pobjTable.AddCell("");

我无法复制基于文档的版本。我不认为多次更改
list.IndentationLeft
会有什么作用。在将该属性添加到某个对象时调用
Process
方法之前,iText不应读取该属性。你能发布一些代码来说明这一点吗?另外,除非是打字错误,因为你说的是
PdfCell
,这是否意味着你使用的是非常旧的、不推荐的和不受支持的4.1.6版本?@ChrisHaas:我使用的是旧版本的iTextsharp(3.1.8.0)。你能升级到新版本吗?当前版本是5.4.3,它可能会解决您的问题。3.1.8.0已经有六、七年的历史了,已经过了支持窗口。@ChrisHaas:我无法升级到新版本。相反,我找到了解决方法,提供了所需的格式。