Skip to content

trouble with listnumers #87

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

Closed
ilnurgi opened this issue Aug 15, 2014 · 1 comment
Closed

trouble with listnumers #87

ilnurgi opened this issue Aug 15, 2014 · 1 comment

Comments

@ilnurgi
Copy link

ilnurgi commented Aug 15, 2014

document = Document()
document.add_paragraph('start')
for i in 'text':
    document.add_paragraph(i, style='ListNumber')
document.add_paragraph('continue')
for i in 'text':
    document.add_paragraph(i, style='ListNumber')
document.add_paragraph('end')
document.save('demo.docx')

this is generated to

start

  1. t
  2. e
  3. x
  4. t
    continue
  5. t
  6. e
  7. x
  8. t
    end

why second list started 5, i need 1

thanks

@scanny
Copy link
Contributor

scanny commented Aug 15, 2014

Hi @ilnurgi, the business of restarting numbering for a numbered list in Word turns out to be quite complex. There's already an open feature request for it here: #25. Also see this response to a similar question on StackOverflow: http://stackoverflow.com/questions/23446268/python-docx-how-to-restart-list-lettering/23464442#23464442.

You can add to the feature request if you like. I'll close this one as a duplicate.

If you're interested in working on it let me know. There are several dependencies though, namely access to styles and numbering definitions, that aren't in place yet. So it would be a bigger job than just the numbering restart itself.

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

2 participants