[IronPython] PowerPoint Automation

kbond kbond at free.fr
Thu Jun 30 21:49:30 CEST 2005


Hello,

I am still playing aound with the office Automation the last I try was
PowerPoint and I was disapointed since I was willing to migrate a macro I have
done a long time ago. This macro create a TOC to a ppt file.



>>>>>>Import sys
>>>>>> sys.LoadAssemblyByName("Microsoft.Office.Interop.PowerPoint")
>>>>>> import Microsoft.Office.Interop.PowerPoint as msPPT
>>>>>> pptApp = msPPT.ApplicationClass()
>>>>>> pptApp.Visible
>>>      
>>>
-1

###### The value of this attribute is strange since for word it is a
boulean############""


>>>>>> pptApp.Visible = True  # is working fine
>>>>>> pptApp.Visible = False
>>>      
>>>
System.Runtime.InteropServices.COMException: Application.Visible : Invalid reque
st.  Hiding the application window is not allowed.
   at input_12.Run(Frame frame)
 #### I am know inable to hide the PowerPoint application ########

>>>>>>
>>>      
>>>
pptApp.Presentations.Open(r"C:\tmp\testAutomation\tocPowerpoint\testMerge.ppt")


>>>>>> listOfSlide=[1,4]
>>>>>> pptApp.Presentations.Item("testMerge.ppt").Slides.Range(listOfSlide)
>>>      
>>>
System.ArgumentException: Slides.Range : Illegal value for ^0. Bad type: expecte
d 1D array of Variants, Integers, Longs, or Strings
   at input_31.Run(Frame frame)
#### In order to specify a range I would expect to be able to give a list intead
of an Array, am I wrong?######
Could you please advise on how I can select a range of slides?

Is it possible to import a pure COM application with ironPython?
Like I am doing using win32com.client.

Thank you again for ironPython.








More information about the Ironpython-users mailing list