Getting list numbering
See original GitHub issueHi all,
I`m wondering how can I get list numbering of paragraphs with style “Paragraph List” So far I got such thoughts:
numId_val = paragraph._element.pPr.numPr.numId.val # getting value for <w:num> in numbering.xml
Next step should be finding <w:num> which corresponds to numId, that I got above
num_obj = filter(lambda x: x.numId == numId_val, document.part.numbering_part.element.num_lst)[0]
Then look into <w:AbstractNum> to get ordering info (such as start value …)
absNum_obj = num_obj.abstractNumId
And that is fail, because it does not represent what I see in xml, I get smth like this
print absNum_obj.xml
<w:abstractNumId xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" w:val="0"/>
Instead of
<w:abstractNum w:abstractNumId="0">
<w:nsid w:val="00000012" />
<w:multiLevelType w:val="hybridMultilevel" />
<w:tmpl w:val="31AE522E" />
- <w:lvl w:ilvl="0" w:tplc="0419000F">
<w:start w:val="1" />
<w:numFmt w:val="decimal" />
<w:lvlText w:val="%1." />
<w:lvlJc w:val="left" />
- <w:pPr>
- <w:tabs>
<w:tab w:val="left" w:pos="720" />
</w:tabs>
<w:ind w:left="720" w:hanging="360" />
</w:pPr>
</w:lvl>
....
</w:abstractNum>
And more, if I manage to get start value, I will have to manually count paragraphs with same level id, then increase start value and only after that I will get numbering of paragraph.
Maybe there is more straightforward and easy way?
Thanks
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:7
Top Results From Across the Web
Change the numbering in a numbered list
Double-click the numbers in the list. The text won't appear selected. · Right-click the number you want to change. · Click Set Numbering...
Read more >Start a Numbered List from any value, not just 1
Go to the numbered list and select the entire list and do a right click and click on Set Numbering Value. The Set...
Read more >How to create a numbered list without the hanging indent ...
A simple numbered list is easy to generate in Microsoft Word. Select the text and click Numbering in the Paragraph group. It's all...
Read more >Add a numbered list, bulleted list, or checklist - Computer
On your computer, open a document in Google Docs. · Double-click the first number. · At the top, click Format and then Bullets...
Read more >Automatic Numbering in Microsoft Word
One of the easiest ways to begin applying numbers is by starting to type a numbered list. Word recognizes that you are creating...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Is this going to implemented? Seems like an old issue, but it is still getting traction, which means it is important for people. I’d love to see a nice API call for retrieving list numbers. 😍
sames