[python-win32] OpenOffice automation

Raymond Yee yee@uclink.berkeley.edu
Fri, 10 May 2002 00:20:35 -0700


Mark Hammond wrote:

> > 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.
>

Yes, in Python:

>>> `objServiceManager.CreateInstance`
'None'

So how do I report this as 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"?
>

Sounds reasonable to me, if it does to you.  I'm happy with being to have a
workaround....

-Raymond