Open
Description
Hi 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
Metadata
Metadata
Assignees
Labels
No labels