At 02:32 AM 10/11/2005, Øyvind wrote:
>Hello.
>
>I need to translate several Word-documents. I have a list with
>approximately 5000 words and its translation, and would like to read thru
>a Word-document, look for the words in the list and replace them. However,
>I need to keep the current formating of the Word-documents. (Using Word
>2003 and XP).
>
>What is the best way of doing this as fast and efficient as possible?

How big are the documents? How many documents?

A) Ask Word to save document in rtf format, then read, translate, save the 
rtf file using Python, then ask Word to open the rtf document and save as a 
Word doc. The only caveat is ensuring that none of the words are also rtf 
keywords.

B) Make Python dictionary with the words as keys and their translations as 
values. Step thru the document's  words collection, look each up in the 
dictionary, replace if found. T

>1) Search and replace for each word directly in Word
>
>2) Exctract the text, run it thru regex and thereafter do a search and 
>replace in Word.
>
>3) Some other way?
>
>(The only language I know is Python, so writing some C++ stuff that can do 
>it a lot faster is not an option).

C++ IMHO would not make things a lot faster. 

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to