I\'m trying to use the python-docx module to replace a word in a file and save the new file with the caveat that the new file must have exactly the same formatting as the ol
We can use python-docx to keep an image on docx.
docx detect image as a paragraph.
But for this paragraph the text is empty.
So you can use like this.
paragraphs = document.paragraphs for paragraph in paragraphs: if paragraph.text == '': continue