Impress to Powerpoint Converter

This script converts an OpenOffice Impress file (sxi) to Microsoft Powerpoint (ppt).

import win32com.client

def createStruct(strTypeName):
    return serviceManager.Bridge_GetStruct(strTypeName)

serviceManager = win32com.client.Dispatch("com.sun.star.ServiceManager")
serviceManager._FlagAsMethod("Bridge_GetStruct")

desktop = serviceManager.createInstance("com.sun.star.frame.Desktop")
url = "file:///c|/collection_data.sxi"

#http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XComponentLoader.html
present = desktop.loadComponentFromURL(url, "_blank", 0, [])

# save as ppt
# filter name:  MS PowerPoint 97
#http://www.openoffice.org/files/documents/25/111/filter_description.html#anchor_impress
saveProperty = createStruct("com.sun.star.beans.PropertyValue")
saveProperty.Name = "FilterName"
saveProperty.Value = "MS PowerPoint 97"
present.storeAsUrl("file:///c|/collection_data.ppt",[saveProperty])

Leave a Reply

Your email address will not be published. Required fields are marked *