Skip to content

Getting list numbering #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
norecces opened this issue Apr 29, 2015 · 7 comments
Open

Getting list numbering #180

norecces opened this issue Apr 29, 2015 · 7 comments

Comments

@norecces
Copy link

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

@superlou
Copy link

I'd also like to get paragraph numbering. Has there been any development of this?

@hcw70
Copy link

hcw70 commented Feb 28, 2017

Also looking for numbering, especcially for sections...

Any hints on this?

@AnisovAleksey
Copy link

up

1 similar comment
@ygcc
Copy link

ygcc commented May 1, 2018

up

@lawquarter
Copy link

sames

@ajdapretnar
Copy link

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. 😍

@Slowhalfframe
Copy link

sames

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants