printing from Word using win32com
Frederick H. Bartlett
fbartlet at wiley.com
Thu Jan 3 11:29:43 EST 2002
Thanks, all, for your help and hints. This function works:
def simpleSample():
myWord = Dispatch('Word.Application')
myWord.Visible = 0
myDoc = myWord.Documents.Add(MYDIR + '\\sampFile.doc')
something = myWord.ActiveDocument.Paragraphs
numParas = something.Count
i = 1
while i < numParas:
i = i + 1
try:
print something.Item(i).Range().encode('utf-8')
except UnicodeError:
print "XXX There was a Unicode Error."
myWord.Quit()
I think I understand Python objects; I'm sure I don't understand
Microsoft objects. *sigh* Why should utf-8 work where latin-1 doesn't?
I thought M$ used (sort of) latin 1? (But I guess that's OT for a
Python ng.)
Fred
More information about the Python-list
mailing list