How to get the list number using .NET

This above link is not working. Please guide us on how to calculate list numbers or get heading number of a paragraph

@crshekharam

Could you please ZIP and attach your input and expected output documents here for our reference? We will then provide you more information about your query along with code.

Using ms word, I am adding paragraphs to document with different Heading styles the document look like,

  1. Paragrapth1

1.1 Paragraph2

1.1.1 Paragraph3

  1. Paragraph4

Now i want to fetch the IndentNumber of the paragraph using Aspose.word. Is there any method is there to fetch?

@crshekharam

You can use ListLabel.LabelString property to get indent number of paragraph. This property returns string representation of list label. Please check the following code example.

Document doc = new Document(MyDir + "input.docx");
doc.UpdateListLabels();

foreach (Paragraph paragraph in doc.GetChildNodes(NodeType.Paragraph, true).OfType<Paragraph>())
{
    if (paragraph.ListFormat.IsListItem)
    {
        ListLabel label = paragraph.ListLabel;
        Console.WriteLine("List label combined with text: " + label.LabelString);
    }
}

Moreover, we suggest you please read the members of ListLabel and ListLevel classes.

1 Like

Thanks. It helped me.