I am using Python-docx to create a Microsoft Word document. The user wants, when he wrote, for example: "Good morning, every body, this is my% (profile_img), do you like it?" in the HTML field, I create a word document and I restore the user image from the database, and I replace the keyword% (profile_img) s with the user image NOT at the END OF THE DOCUMENT . With Python-docx, we use this instruction to add an image:
document.add_picture('profile_img.png', width=Inches(1.25))
The image is added to the document, but the problem is that it is added at the end of the document. Is it not possible to add an image at a specific position in a Microsoft Word document using python? I did not find any answers to this on the net, but I saw people asking the same thing elsewhere without a solution.
Thank you (note: I'm not a very experienced programmer and apart from this awkward part, the rest of my code will be very simple)
source
share