[python-win32] Implementing Collections / Shim-ing Word

Mark Hammond mhammond at skippinet.com.au
Sat Jul 12 09:03:16 CEST 2008


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

So what is you question?  If it is asking why your Add method doesn't work
as you expect, I'm afraid I lack the telepathic powers to mind-read your
code.

Mark




More information about the python-win32 mailing list