开发者

How to save pictures to document with Python win32com

I am making html to doc converter

from win32com.client import Dispatch

wrd=Dispatch('Word.Application')

doc=wrd.Documents.Open(inputfile)

doc.SaveAs(outputfile, FileFormat=0)

doc.Close

And I wand save picture to document: Prepare->Edit links to file->Save pi开发者_运维技巧cture to document

What command I need?

http://i.stack.imgur.com/SJOS7.png


I believe you are looking for the AddPicture method in the InlineShapes collection.

FileName

Required String. The path and file name of the picture.

LinkToFile

Optional Object. True to link the picture to the file from which it was created. False to make the picture an independent copy of the file. The default value is False.

**SaveWithDocument**

Optional Object. True to save the linked picture with the document. The default value is False.

Range

Optional Object. The location where the picture will be placed in the text. If the range isn't collapsed, the picture replaces the range; otherwise, the picture is inserted. If this argument is omitted, the picture is placed automatically.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜