[python-win32] saving an ole control object embedded in a powerpoint

Mark Hammond mhammond at skippinet.com.au
Mon Feb 20 23:44:57 CET 2006


> The problem is that I don't know how to obtain something that would be
> accepted as an IStream (through python/com machinery) and that would
> write everything to a file or in a string, and that I can read later.

Look at the win32com.server.util FileStream class.  Usage would be something
like:

from win32com.server.util import wrap, FileStream

f = open(filename, "wb")
fs = FileStream(f)
# Turn it into a "real" COM object.
fs = wrap(fs)
# Pass it to COM
pythoncom.OleSaveToStream(persist, fs)

Untested, but that is the idea.

Mark



More information about the Python-win32 mailing list