Python
0
Вклад в тег
from docxtpl import DocxTemplate,InlineImage
import glob
from docx.shared import Mm
#берем документ
doc = DocxTemplate('3.docx')
imageObjs = []
for fPath in glob.glob('1/*.jpg'):
print(fPath)
imgObj = InlineImage(doc, fPath, height =Mm (65))
imageObjs.append(imgObj)
context = {
"images": imageObjs
}
doc.render(context)
doc.save("context.docx")