question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feature: BlockItemContainer.iter_block_items()

See original GitHub issue

I’d like to iterate over the elements of they document as they appear in it. For example if there is a paragraph a table and then a paragraph again, I want to get them in that order. AFAIK currently there are two properties on Document, paragraphs and tables but have no notion of ordering between them.

Issue Analytics

  • State:open
  • Created 9 years ago
  • Reactions:13
  • Comments:33 (10 by maintainers)

github_iconTop GitHub Comments

6reactions
cez81commented, Apr 8, 2015

Ok got it working now! Changed it to:

if isinstance(parent, Document):
    parent_elm = parent.element.body

Thanks for the help both of you!

3reactions
nguyen1110935commented, Mar 3, 2018

Hi @scanny

your iter_block_items() parse paragraph and table in docx file. I’m a beginner in python. Could you please update to parse all headings (Heading 1, Heading 2,…etc), paragraphs and tables.

Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found