Hello,
I want to find out if a MSOffice document has or not a thumbnail (preview save picture). If yes I would like to save this thumbnail in a .jpeg file, if no, i want to save a temporary preview picture of this document and obtain the thumbnail in a .jpeg file.
 
Unfortunately this doesn't work. When  I do:
def PrintStats(filename):
    if not pythoncom.StgIsStorageFile(filename):
        print "The file is not a storage file!"
        return
    # Open the file.
    flags = storagecon.STGM_READ | storagecon.STGM_SHARE_EXCLUSIVE
    stg = pythoncom.StgOpenStorage(filename, None, flags )
 
    # Now see if the storage object supports Property Information.
    try:
        pss = stg.QueryInterface(pythoncom.IID_IPropertySetStorage)
    except pythoncom.com_error:
        print "No summary information is available"
        return
    # Open the user defined properties.
    ps = pss.Open(FMTID_UserDefinedProperties)
    props = PIDSI_TITLE, PIDSI_SUBJECT, PIDSI_AUTHOR, PIDSI_CREATE_DTM, PIDSI_THUMBNAIL
    data = "" props )
    # Unpack the result into the items.
    title, subject, author, created, thumbnail = data
    print "Title:", title
    print "Subject:", subject
    print "Author:", author
    print "Created:", created.Format ()
    print "Thumbnail:", thumbnail

If the thumbnail doesn't exists, it returns None, if It exists, it returns me :

 

data = "" props )
TypeError: Unsupported property type
   

Please, somebody can help me?

thanks

Rena 

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to