Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word Automation Underline problem when Visible = .F.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00621252
Message ID:
00621262
Vues:
10
>My application creates a Word document, and enters some formatted text. Each paragraph starts with an underlined word. The way I do this is to add the word and a space, select the word (but not the space), and underline. Then I move the cursor to the end of the line (after the non-underlined space) and add the rest of the text.
>
>It works when I emulate these actions in Word. And it works using Word automation, BUT only if loWord.VISIBLE = .T. If I leave Word non-visible while sending the commands to enter the text, then when I finally do issue loWord.VISIBLE = .T., the whole paragraph is underlined.
>
>Any ideas on how I can make this work so that Word is hidden until I'm done producing the text? Thanks in advance!
>zahid

Not sure this is what you need but try it (I do not say this is the best way)
loWord= CREATEOBJECT('Word.Application')
loWord.Documents.Add
loWord.Documents(1).Range.InsertAfter('firstword')
loWord.Documents(1).Words(1).Underline = .t.
loWord.Documents(1).Range.InsertAfter(SPACE(1)+ 'secondword')
loWord.Documents(1).Words(2).Underline = .f.
loWord.Documents(1).Range.InsertAfter(SPACE(1)+ 'thirdword')
loWord.Documents(1).Paragraphs.Add
loWord.Documents(1).Range.InsertAfter('firstword@SecPara')
loWord.Documents(1).Words(5).Underline = .t. && Paragraph itself is counted as word?! Do not know why
loWord.Documents(1).Range.InsertAfter(SPACE(1)+ 'secondword')
loWord.Documents(1).Words(6).Underline = .f.
loWord.Documents(1).Range.InsertAfter(SPACE(1)+ 'thirdword')
loWord.Documents(1).Paragraphs.Add
loWord.Visible = .t.
HTH
Zlatin Zlatev,
MCSD (VS6)

Make solutions, not programs!

Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform