[python-win32] OpenOffice automation

Mark Hammond mhammond@skippinet.com.au
Fri, 10 May 2002 16:59:57 +1000


> I've had luck using Perl and VB to access OpenOffice.  Is the
> reason I'm able
> to use those COM client implementations that through the syntax of those
> implementations, I'm able to clear indicate that createInstance
> is a *method*
> and not a *property*?
>
> For example,  in Perl Win32::OLE, the following works::
>
> $objDesktop =
> $objServiceManager->createInstance("com.sun.star.frame.Desktop");
>
> If I wanted to access createInstance -- the *property*, I would write:
>
> $objDesktop = $objServiceManager->createInstance;

Can you check if the latter does indeed return None.  If so, you should
report a bug.

> Is there a way with pythoncom but having no access to any type
> library to say
> "I know it's a method and not a property, don't try to access the
> property --
> just go for the method"?

Nope :(  It would be pretty easy to add though, and would be generally
useful (a similar issue has come up before).  One way would be to add
support so you could say:

ob = Dispatch("...")
ob._MarkAsMethod("createInstance") # hack around problems with staroffice.

ob.createInstance() would then work as expected.

Sound reasonable?  If so, what is a better spelling of "_MarkAsMethod"?

Mark.