Hello,

Congratulation, for this new release correcting some bugs around the
"PIA ComObject Operations".
I spent the last hours playing around with this great feature of ironpython and 
 I would like to share with you a couple
of things.
Some are working fine some seems strange to me but it
might be because I am missing something and some that are not working.



Scenario 1

IronPython 0.7.6 on .NET 2.0.50215.44
Copyright (c) Microsoft Corporation. All rights reserved.

import sys
sys.LoadAssemblyByName("Microsoft.Office.Interop.Word")
import Microsoft.Office.Interop.Word as wordApp
mApp= wordApp.ApplicationClass()
mApp.visible
False

mApp.visible = True
mApp.Documents.Open("c:\tmp\Doc1.doc")
System.Runtime.InteropServices.COMException: The document name or path is not va
lid.
Try one or more of the following:
* Check the path to make sure it was typed correctly.
(c:    mp\Doc1.doc)click Open. Search for the file using this dialog box.
  at input_6.Run(Frame frame)


####### I do not undertstand why this is not working however a
slightly modified  statement is working well##########


doc1 = mApp.Documents.Open(r'c:\tmp\Doc1.doc')
doc1.Save()
doc1.Close()


Scenario 2

doc1 = mApp.Documents.Open(r'c:\tmp\Doc1.doc')
doc2 = mApp.Documents.Add()
doc2.SaveAs(r"c:\tmp\Doc2.doc")
for i in mApp.Documents:
...     print i.Name
...
System.Runtime.InteropServices.COMException: Unknown name. (Exception from HRESU
LT: 0x80020006 (DISP_E_UNKNOWNNAME))
  at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr,
Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[]
namedParameters)
  at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Bi
nder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers
, CultureInfo culture, String[] namedParams)
  at input_24.Run(Frame frame)

###### I do not understand why I cannot iterate in the collection of
Documents######
###### May be this is not supposed to work but it would be amazingly
efficient########


mApp.Documents("Doc1.doc").Activate()
System.Runtime.InteropServices.COMException: Unknown name. (Exception from HRESU
LT: 0x80020006 (DISP_E_UNKNOWNNAME))
  at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr,
Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[]
namedParameters)
  at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Bi
nder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers
, CultureInfo culture, String[] namedParams)
  at input_29.Run(Frame frame)

##### Another problem when working with a collection of documents #####
##### I cannot select a given document using its Name #####

Scenario 3
##### I would like to translate the following vb statement in python######
#vb#### Documents.Open FileName:="C:\Files\Doc.doc", ReadOnly:=True####
doc3 = mApp.Documents.Open(FileName='c:\tmp\Doc1.doc', ReadOnly= True)

System.Exception: this object is not callable with keyword parameters
  at input_32.Run(Frame frame)

#### Obviously, my guess was wrong but I do not have any idea on how
to do such thing any advise would be more than welcome######


Could you please help me to positionned win32com and IronPython?
Would it be possible to do the same things with IronPython than with win32com?
Thank you very much for your answers, I hope that will help you .....

Regards


_______________________________________________
users-ironpython.com mailing list
users-ironpython.com@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to