Python and Word

Alex K. Angelopoulos aka at mvps.org
Thu Jan 16 02:25:28 EST 2003


FYI, Anthony, I know your problem was actually syntax, but there is one other
thing you should know... that's actually inherited from the Word object model.
Anytime you dig underneath an object declared with

    win32com.client.Dispatch('x')

you are actually dealing with things internal to the object.

The good side of that is that the object model documentation from the OEM
contains details on it (in the case of Microsoft Office apps, the VBA help files
for the objects may have detailed info).  The bad side is that the docs are not
always complete or correct, which may leave you relying on information
autogenerated by Python.

-- 

"Anthony Evershed" <anthony.evershed at npl.co.uk> wrote in message
news:2eb85cfb.0301150147.134c34a3 at posting.google.com...
> I'm trying to get Python 2.2.2 with Win32all extensions to use Word
> 2000's alignment tool when pushing data in. I have found the win32com
> command:
>
> wd.Selection.Paragraphs.Alignment(?)
>
> (where wd = win32com.client.Dispatch('word.application')
>
> But am stuck as to the argument to use for left align and centering.
> PythonWin suggested an integer, but tests in interactive mode produced
> only errors as below:
>
> >>> wd.Selection.Paragraphs.Alignment(1)
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
> TypeError: 'int' object is not callable
>
> Can anyone help?
>
> Anthony Evershed






More information about the Python-list mailing list