I need to fetch the images adress in word document along with text and tables. Using doc.element.body loop I can't get image recognise, using doc.part.rels.values loop I can only get images. If suggest if there any way to extract the text , tables, images in same order as in source document.
1 Answer
In python-docx there is no direct access to images in the document structure. To extract text, tables, or images in the original order, you have to parse the XML tree manually (doc.element.body.iter()), checking for tags like w:p for paragraphs, w:tbl for tables, and w:drawing or w:pict for images.