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

2011-06-14 Thread Preston Landers
I think you'll have to get into the guts of the Document object to do things like that. Here's the official Word 2007 object model documentation. Any tutorials or examples you can find that use other languages like C# or VB.NET would be relevant, you just have to translate them a bit to Python. T

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

2011-06-14 Thread cool_go_blue
Thanks. I just find that all item numbers such as 1.1.1 are gone. How can I get these numbers. Also, If all items are in a table, how can I get the contents of all items and ignore the table structure. Thanks. --- On Tue, 6/14/11, Tim Roberts wrote: From: Tim Roberts Subject: Re: [python-win

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

2011-06-14 Thread Tim Roberts
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 the following code: > > for word in doc.Content.Text.encode("cp1252", "replace"): > print word > > It seems that word is each a cha

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

2011-06-14 Thread cool_go_blue
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 the following code: for word in doc.Content.Text.encode("cp1252", "replace"):     print word It seems that word is each a character. How can I find API to pro

Re: [python-win32] py2.7 and multiple DDE servers on Win32, possible?

2011-06-14 Thread RayS
Ahh, this http://www.codeproject.com/KB/MFC/MFCinVisualStudioExpress.aspx might help. I'll work through it later... I do have VS6, but I'm assuming that I really need 2008 (?). Thanks, Ray At 10:13 PM 6/13/2011, Roger Upole wrote: Compiling with VC 2008 Express is going to be a problem. The fr

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

2011-06-14 Thread Tim Roberts
cool_go_blue wrote: > 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

[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",

Re: [python-win32] Converting HTML formatting to Microsoft Word

2011-06-14 Thread sharpblade
Ah yes, sorry I didn't specify that. It is part of an existing doc: I have a Django web application with a Report model which contains information I need to put into a word document. Most of this is simple stuff requiring no formatting, and I achieve this by defining several bookmarks within the ma

Re: [python-win32] Converting HTML formatting to Microsoft Word

2011-06-14 Thread Tim Golden
On 14/06/2011 00:20, Tom wrote: Hello, I have a Javascript rich text editor (Specifically the Yahoo UI libraries Simple Editor) which I have embedded within my web application. This produces formatted HTML from the users input which has to be placed within a Word document. The number of formattin