向 Word 文件中插入图片
向 Word 文件插入图片的语法为:

例如,在 cl ip graph.docx 文件的第 4 段插入 ce ll.jpg 图片,井将图片文件保存于
Word 文件内:
import os
from win32com import client

word = client.gencache.EnsureDispatch('Word.Application')
word.Visible = 1
word.DisplayAlerts = 0
# cpath=os.path.dirname(__file__)
doc = word.Documents.Open("F:\\pythonBase\\pythonex\\ch08\\media\\clipgraph.docx")
paragraphs = doc.Paragraphs
range1 = paragraphs(4).Range
range1.InlineShapes.AddPicture("F:\\pythonBase\\pythonex\\ch08\\media\\cell.jpg", False, True)
#doc.Close()
#word.Quit()