Hi,
I downloaded the sample examples of Aspose.Words from Aspose website to work with Paragraph Lists. In the downloaded files one of the file is “ExLists.cs” in “Exapmples” folders. This “ExLists.cs” file contains one of the below method:
[Test]
public void DetectBulletedParagraphs()
{
Document doc = new Document();
// ExStart
// ExFor:Paragraph.ListFormat
// ExFor:ListFormat.IsListItem
// ExFor:List.ListId
// ExSummary:Finds and outputs all paragraphs in a document that are bulleted or numbered.
NodeCollection paras = doc.GetChildNodes(NodeType.Paragraph, true);
foreach(Paragraph para in paras)
{
if (para.ListFormat.IsListItem)
{
Console.WriteLine(string.Format(" A paragraph belongs to list {0}", para.ListFormat.List.ListId));
Console.WriteLine(para.GetText());
}
}
// ExEnd
}
I executed this code on one of the document which contains List numbers, but the property para.ListFormat.List.ListId is always showing number One(1) for all the lists. I attached my test document.
Could i know how to get correct ListItem number??
Thanks,