I'm looking for vb.net code to check if a certain pargraph (by paragraph number) is bulleted (not just listed) and extract the bullet symbol.
Thank you in advance!
Dim doc As Document = New Document("C:\test.docx")
Dim sb As StringBuilder = New StringBuilder()
For Each section As Section In doc.Sections
For Each pgh As Paragraph In section.Paragraphs
If pgh.ListFormat.ListType = ListType.Bulleted OrElse (pgh.ListFormat.ListType = ListType.Numbered AndAlso Not pgh.StyleName.Equals("Heading1", StringComparison.OrdinalIgnoreCase)) Then
If pgh.ListFormat.ListType = ListType.Bulleted Then
sb.Append(pgh.ListFormat.CurrentListLevel.BulletCharacter & vbCrLf)
Else
Console.WriteLine("This paragraph is a numbered list")
End If
End If
Next
Next
Dim result As String = "result.txt"
File.WriteAllText(result, sb.ToString())