Read detailed style of paragraph in docx-file?

16 Views Asked by At

i try to read a doxc-file using python-docx paragraph by paragraph using the following code:

for p in document.paragraphs:
  wStyleName = p.style.name
  wText = p.text

My problem is that i can´t distinguish between a "normal" paragraph and a paragraph where there is also a list numbering.

In both cases the output for the p.style.name is "Normal"

I there any way how i can distiguish between a "normal" paragraph and a "special" paragraph (like List Number, List Bullet, Intense Quote, etc)?

(when creating a paragraph i can set this with the following code - but i would need it to get the info when reading a docx-file)

document.add\_paragraph('Intense quote', style='Intense Quote')
document.add\_paragraph('first item in unordered list', style='List Bullet')
document.add\_paragraph('first item in ordered list', style='List Number')
0

There are 0 best solutions below