How can I add multiple images to a word file by giving the path of the folder containing the images using python
Asked
Active
Viewed 795 times
-2
-
You can follow [this](http://techs.studyhorror.com/d/python-inserting-images-into-word-documents) tutorial. – Ori David Jan 20 '21 at 13:45
-
The first step is to read the documentation of whatever library you are using to work with word files. If you don't use any yet, try [python-docx](https://python-docx.readthedocs.io/en/latest/) – Yevhen Kuzmovych Jan 20 '21 at 13:45
1 Answers
0
from docx import Document
from docx.shared import Inches
document = Document()
p = document.add_paragraph('Picture bullet section', 'List Bullet')
p = p.insert_paragraph_before('')
r = p.add_run()
r.add_picture(picPath)
p = p.insert_paragraph_before('My picture title', 'Heading 1')
document.save('demo_better.docx')

Erfan Taghvaei
- 144
- 10