Skip to content

Unable to detect bullet point style in a docx file #1540

@Ironfort9

Description

@Ironfort9

Hello, I'm currently working on a project where I at the moment need to detect which paragraphs use a bullet point, and the method I found in the documentation to do so was by using the paragraph.style.name property, but when I attempt to search for it using the style property the style of the paragraphs with bullet points is the basic "Body Text" and not "Bullet Point" as what I'd expect. The paragraph itself in Google Docs and LibreOffice Writer are detected as unordered lists, so that is working correctly, so I can't figure out what is happening for this to not work.

Is there an alternative method currently available to detect them or am I messing up somewhere with this?

My code currently is this:

file = "foo/bar.docx"

doc = Document(file)

for paragraph in doc.paragraphs:
    print(paragraph.text, "\n", paragraph.style.name)

TestDocument.docx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions