MS Word -- finding text
Prema
prema at prema.co.nz
Sat Jun 15 15:40:40 EDT 2002
Hi David !
Thanks for your response.
The script I am building is intended to provide a search facility over
a group of word docs. The strategy is to pull plain text from the doc
in numbered paragraphs then search each para in Python and return any
found ones.
Simplified code so far .....
#######
from win32com.client import Dispatch
W=Dispatch('Word.Application')
D=W.Documents.Open('c:\\windows\\Desktop\\TOR.doc') ## Test Doc
FindRange=D.Content
F=FindRange.Find.Execute('Conman','True')
print FindRange.Text
#######
str() doesn't seem to work in this case
I tried using the codecs library but I think I am missing something
Thanks for your help with this !!
Kind regards
Mike
"David LeBlanc" <whisper at oz.net> wrote in message news:<mailman.1024124539.13851.python-list at python.org>...
> Please post some snippets. That's always more likely to get useful
> assistance then stating a general problem.
>
> Where are you encountering the unicode decoding problem?
>
> Regards,
>
> David LeBlanc
> Seattle, WA USA
>
> > -----Original Message-----
> > From: python-list-admin at python.org
> > [mailto:python-list-admin at python.org]On Behalf Of Prema
> > Sent: Friday, June 14, 2002 23:50
> > To: python-list at python.org
> > Subject: MS Word -- finding text
> >
> >
> > Hi All !
> > Just wondering if anyone has some sample code around how to open a
> > document, find a string and return the paragraph(s) containing the
> > string.
> >
> > I have got a good part of the way but running up against Unicode
> > decoding
> >
> > Can post some snippets if needed
> > Thanks very much in advance
> >
> > Kind regards
> > Mike
> > --
> > http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list