I have a small question about working with opened docx-file. This is part of my code:
doc = Document(self.fileName[0])
for paragraph in doc.paragraphs:
s
This operation is not yet directly supported by the python-docx API. However you can find a workaround function for it here:
https://github.com/python-openxml/python-docx/issues/40
and a little further information may be found by searching on 'python-docx iter block items'.
The basic problem is that the Microsoft API for Word does not include a method for iterating block-level items in document order. Block-level items in Word are the paragraph and table objects. python-docx modeled the MS API as its starting point and so the Document.paragraphs and Document.tables properties were the first to be implemented. Document.iter_block_items() or perhaps just Document.block_items hasn't been implemented yet, although it's closer to the top of the enhancement list than many other features because it's frequently asked for.
In the meantime, you'll need to implement a workaround function in your own code.