[python-win32] Searching in Word-document

Szabo, Patrick (LNG-VIE) patrick.szabo at lexisnexis.at
Thu Feb 9 13:45:32 CET 2012


Hi, 

I'm trying to find words in a document that are Bold or Italic and have
a format called "Standard text"."
Is this possible without checking every word ?

Right now I'm doing this:

for word in doc.Words:
	if unicode(word.Style) == u"Standard Text" and word.Font.Bold ==
-1: 
		errors.append(["",u"'%s' ist Bold aber als 'Standard
Text' ausgezeichnet!" % word, ""])
	elif unicode(word.Style) == u"Standard Text" and
word.Font.Italic == -1: 
                   	errors.append(["",u"'%s' ist Italic aber als
'Standard Text' ausgezeichnet!" % word, ""])

But it takes forever :(

Thx in advance!

. . . . . . . . . . . . . . . . . . . . . . . . . .
Ing. Patrick Szabo
 XSLT Developer 
LexisNexis
A-1030 Wien, Marxergasse 25

mailto:patrick.szabo at lexisnexis.at
Tel.: +43 1 53452 1573 
Fax: +43 1 534 52 146 







More information about the python-win32 mailing list