[python-win32] UnicodeEncodingError when print a doc file

Tim Golden mail at timgolden.me.uk
Wed Jun 15 16:50:32 CEST 2011


On 15/06/2011 15:30, Tom Hawkins wrote:
> By ‘manually’ I mean choosing the File->Save As menu item and changing
> ‘Save as type’ to Plain Text.
>
> I’m not familiar with how to automate it directly from Python, but in
> Word VBA you would use something like:
>
> ActiveDocument.SaveAs FileName:="myfile.txt", FileFormat:=wdFormatText

.. and for anyone who couldn't guess, in Python that would be something
like:

ActiveDocument.SaveAs (
   FileName="myfile.txt", 
FileFormat=win32com.client.constants.wdFormatText
)

TJG


More information about the python-win32 mailing list