I'm trying to pull apart a word document that looks like this:
1.0 List item
1.1 List item
1.2 List item
2.0 List item
It is stored in docx, and I'm using python-docx to try to parse it. Unfortunately, it loses all the numbering at the start. I'm trying to identify the start of each ordered list item.
The python-docx library also allows me to access styles, but I cannot figure out how to determine whether the style is a list style or not.
So far I've been messing around with a function and checking output, but the standard format is something like:
for p in doc.paragraphs:
s = p.style
while s.base_style is not None:
print s.name
s = s.base_style
print s.name
Which I've been using to try to search up through the custom styles, but the all end at "Normal," as opposed to the "ListNumber."
I've tried searching styles under the document, the paragraphs, and the runs without luck. I've also tried searching p.text, but as previously mentioned the numbering does not persist.