Re: [python-win32] a trivial question

2012-03-08 Thread cool_go_blue
r analysis? Thanks. B. --- On Thu, 3/8/12, Vernon Cole wrote: From: Vernon Cole Subject: Re: [python-win32] a trivial question To: "cool_go_blue" Cc: python-win32@python.org Date: Thursday, March 8, 2012, 2:48 PM self.doc.Tables(1).Cell(row,2) is not a string, and therefore has no .

[python-win32] a trivial question

2012-03-08 Thread cool_go_blue
I try to use comprehensions when I am learning Python. After opening a word document, i try to read the 2nd column of a table for each row. I print out the words as follows:   for row in range(1,len(self.doc.Tables(1).Rows)+1):    for word in str(self.doc.Tables(1).Cell(row,2)).split():   if

Re: [python-win32] UnicodeEncodingError when print a doc file

2011-06-15 Thread cool_go_blue
time and memory to read a text file than the general input stream? Thanks again. --- On Wed, 6/15/11, Tim Roberts wrote: From: Tim Roberts Subject: Re: [python-win32] UnicodeEncodingError when print a doc file To: "Python-Win32 List" Date: Wednesday, June 15, 2011, 7:52 PM cool_go_

Re: [python-win32] UnicodeEncodingError when print a doc file

2011-06-15 Thread cool_go_blue
codeEncodingError when print a doc file To: "Python-Win32 List" Date: Wednesday, June 15, 2011, 4:12 PM cool_go_blue wrote: > Thank you so much. It works. But where can I find the APIs such as > Dispatch vs gencache.EnsureDispatch? > To a certain extent, this comes from on-the

Re: [python-win32] UnicodeEncodingError when print a doc file

2011-06-15 Thread cool_go_blue
Date: Wednesday, June 15, 2011, 3:26 PM cool_go_blue wrote: > this is the first three lines of my code: > > app = win32com.client.Dispatch('Word.Application') > app.Documents.Open('D:\projects\Myself\HelloPython\src\Drugreservoir.doc') > app.ActiveDocumen

Re: [python-win32] UnicodeEncodingError when print a doc file

2011-06-15 Thread cool_go_blue
I did try the one you suggest. But I got:   File "D:\projects\Myself\MySVD\src\ReadWord.py", line 11, in     app.ActiveDocument.SaveAs('D:\projects\Myself\HelloPython\src\Drugreservoir1.txt',FileFormat=win32com.client.constants.wdFormatText)   File "D:\Softwares\Python27\lib\site-packages\win32c

Re: [python-win32] UnicodeEncodingError when print a doc file

2011-06-15 Thread cool_go_blue
. But what API should I use to read all words and the auto-number of this paragraph. It seems a huge table in each object map. Thanks. -- On Tue, 6/14/11, Preston Landers wrote From: Preston Landers Subject: Re: [python-win32] UnicodeEncodingError when print a doc file To: "cool_go_blue

Re: [python-win32] UnicodeEncodingError when print a doc file

2011-06-14 Thread cool_go_blue
-win32] UnicodeEncodingError when print a doc file To: "python-win32@python.org" Date: Tuesday, June 14, 2011, 9:02 PM cool_go_blue wrote: > Thanks. It works. Actually, what I want to do is to parse the whole > document. How can I retrieve the list of words in the > document? I use

Re: [python-win32] UnicodeEncodingError when print a doc file

2011-06-14 Thread cool_go_blue
ow can I find API to process words in an open word document. Thanks. --- On Tue, 6/14/11, Preston Landers wrote: From: Preston Landers Subject: Re: [python-win32] UnicodeEncodingError when print a doc file To: "cool_go_blue" Date: Tuesday, June 14, 2011, 12:37 PM The document contains

[python-win32] UnicodeEncodingError when print a doc file

2011-06-14 Thread cool_go_blue
I try to read a word document as follows: app = win32com.client.Dispatch('Word.Application') doc = app.Documents.Open('D:\myfile.doc') print doc.Content.Text I receive the following error: raceback (most recent call last):   File "D:\projects\Myself\MySVD\src\ReadWord.py",