How to get text of list item using .NET

Is there any way to determine the text of the list number for a paragraph that has "IsListItem=true" on its ListFormat?

For example, if my document looked like this:

  1. This is the first item
  2. This is the second item

Then the two paragraphs would just read "This is the first item" and "This is the second item". I'm looking for something that would give me "1." and "2.", respectively.

I know the list number is calculated based on the list format, list level, and its position in the list, but is there a way to get this text automatically or would I just have to piece it together myself?

Hi,

Thanks for your query. Unfortunately, there is no way to get list item numbers using Aspose.Words. These numbers are not stored in the document. MS Word calculates list numbers on the fly during opening document. However, you can try to create your own method for calculating list numbers.

Hi there,


Thanks for your inquiry.

I’m afraid Tahir is little incorrect with this one, Aspose.Words does provide a class to achieve this. To get the value of a list item you can use the ListLabel class and the ListLabel.LabelValue member.

Thanks,