We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to read bulleted lists of text from word


I want to read bulleted lists of a text from word document in vb.net

Anil K.

Hi Anil,

Thanks for your inquiry. Please use following code example to read the list items in Word document.

If this does not help you, please share some more detail about your query along with input Word document. We will then provide you more information on this along with code.

Dim doc As New Document(MyDir + "Lists.PrintOutAllLists.doc")
Dim listParaCount As Integer = 1
For Each paragraph As Paragraph In doc.GetChildNodes(NodeType.Paragraph, True)
    ' Find if we have the paragraph list. In our document our list uses plain arabic numbers,
    ' which start at three and ends at six.
    If paragraph.ListFormat.IsListItem Then
        Console.WriteLine("Paragraph #{0}", listParaCount)
        ' This is the text we get when actually getting when we output this node to text format.
        ' The list labels are not included in this text output. Trim any paragraph formatting characters.
        Dim paragraphText As String = paragraph.ToString(SaveFormat.Text).Trim()
        Console.WriteLine(Convert.ToString("Exported Text: ") & paragraphText)
        Dim label As ListLabel = paragraph.ListLabel
        ' This gets the position of the paragraph in current level of the list. If we have a list with multiple level then this
        ' will tell us what position it is on that particular level.
        Console.WriteLine("Numerical Id: " + label.LabelValue)
        ' Combine them together to include the list label with the text in the output.
        Console.WriteLine(Convert.ToString("List label combined with text: " + label.LabelString + " ") & paragraphText)
        listParaCount += 1
    End If