[python-win32] Need help with AutoSummarize feature in Word

Tim Roberts timr at probo.com
Mon Apr 24 19:49:05 CEST 2006


On Sat, 22 Apr 2006 09:20:07 -0400, "Daniel Greenfeld"
<pydanny at gmail.com> wrote:

>>> Date: Fri, 21 Apr 2006 10:00:33 -0700
>>> From: Tim Roberts <timr at probo.com>
>>
>First off, thanks very much Tim for the help.  Your advice made a big
>difference!
>  
>

I'm glad to hear it, and I appreciate the feedback.


>>>> >    def autoSummarize(self, Length = 30, Mode =
>>>> >wdSummaryModeCreateNew, UpdateProperties = True):
>>>> >        """ I do the autosummary and return the content.  This
>>>> >actually creates a new tmp word file."""
>>>> >        try:
>>>> >            self.app.ActiveDocument.AutoSummarize(Length, Mode,
>>>> >UpdateProperties)
>>>> >
>>>      
>>>
>>> AutoSummarize returns a Range object.  It may be possible to get the
>>> text directly from this Range object, instead of relying on the
>>> ActiveDocument property.
>>    
>>
>
>Can you help me with finding documentation or examples of different
>ways to play with the Range objects?  The MSDN docs seem to be
>assuming I already know what a Range is.
>


Yes, the documentation on the Office object model can be a little
frustrating.  I usually start with Google ("Word object model range")
and focus in from there.

Here's the MSDN page on the Range object:
   
http://msdn2.microsoft.com/en-us/library/microsoft.office.interop.word.range_members.aspx

There is a Text member that should return to you the entire contents.

By the way, one of the best ways to explore these object models is to
use the command-line interpreter, or something like Pythonwin.  That's
how I found out that the Open method returned a Document object.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-win32 mailing list