With both the actual(MS Word) and simulated(my COM server)
configurations, I am returned a generic COM object when trying to use
the 'Documents' object.

>>> w = Dispatch("Word.Application.8")
>>> d = w.Documents
>>> d
<COMObject <unknown>>

I think this relates to being late-bound. Anyway, whereas Word's
'Documents' collection has an Add() that creates a new document in the
collection, my server has magically grown an Add() that requires 2
params, including an instance.

>From previous discussion, my com server is shown here.

class OOoShim:
        _public_methods_ = []
        _public_attrs_ = ['Documents']
        _reg_progid_ = 'Word.Application.8'
        _reg_clsid_ = '{E313D9AC-DE79-4587-971F-A054829819D6}'

        def __init__(self):
                self.Documents = NewCollection([])

If I can get an understanding of how these collections work on the
Python side vs the COM side, I'll be make some progress.


On Wed, Jul 2, 2008 at 7:21 PM, Mark Hammond <[EMAIL PROTECTED]> wrote:
> Attributes will need to be in an instance of the class, not the class itself
> (the instance's __dict__ is used).  Also, yu probably want to read up on
> registering your classes with "--debugging" so you can see tracebacks and
> other details of the implementation.
>
> Cheers,
>
> Mark
>
>
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:python-win32-
>> [EMAIL PROTECTED] On Behalf Of jeff sacksteder
>> Sent: Thursday, 3 July 2008 12:56 AM
>> To: python-win32@python.org
>> Subject: [python-win32] Implementing Collections / Shim-ing Word
>>
>> I have a legacy application that uses Word as printing engine for
>> standardized forms via COM. I'm trying to develop a thin COM server
>> shim that implements the minimum required to intercept those requests
>> and routes them to another application(likely OOo). I had hoped that
>> the free Word doc viewer implemented a COM server, but no luck.
>>
>> To do this I need to create a public 'Documents' collection, which I'm
>> not able to do. The app produces an error saying:
>>
>> Error Code: Member not found
>> Subsystem: OLE Automation Client
>> Error Subcode: 1
>> Function: DOCUMENTS
>> Description: Member not Found
>>
>> (I take that to actually mean a member, not a true function in the 4th
>> line)
>>
>> The important part of the server is:
>>
>> class OOoShim:
>>       _public_methods_ = []
>>       _public_attrs_ = ['Documents']
>>       _reg_progid_ = 'Word.Application.8'
>>       _reg_clsid_ = '{E313D9AC-DE79-4587-971F-A054829819D6}'
>>
>>       Documents = NewCollection([])
>>
>> I've tried 'Documents' as an attribute and as a function returning a
>> collection. This looks like a manageable problem, but I'm stuck on
>> creating these Collections.
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to