Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can I?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Titre:
Re: Can I?
Divers
Thread ID:
00309314
Message ID:
00309969
Vues:
29
>Some sample code would be helpful, if it's not too much trouble.
>
>I may end up going against the client's wishes and doing it the Word way afterall, if that's the best way. Which I bet it is.
>
>Thanks very much.

oWord = CREATEOBJECT("Word.Application")
oWord.Documents.Add()
* Insert the text from the table
oWord.Selection.TypeText(MyTable.MyMemo)

oSele = oWord.Selection
WITH oSel.FIND
.TEXT = "^"
.Forward = .T.
.WRAP = wdFindContinue
.FORMAT = .F.
.MatchCase = .F.
.MatchWholeWord = .F.
.MatchWildcards = .F.
.MatchSoundsLike = .F.
.MatchAllWordForms = .F.
ENDWITH

WITH oSel
DO WHILE .Find.Execute && the first ^
lnStart = .Start
.DELETE(wdCharacter,1)
IF .Find.Execute && goes to the second ^
lnEnd = .Start
.Start= lnStart-1
.End = lnEnd
.FONT.Bold = wdToggle
.FONT.SIZE = 10
.Start= lnEnd
.End = lnEnd
.DELETE(wdCharacter,1)
ENDIF
ENDDO
ENDWITH

This code assumes that text that should be bolded is surrounded by "^" characters. You can use any character or string you wish, and have that character represent any type of formatting (different font, underline, etc.)

This code was assembled by recording macros in word and observing the VBA code generated in the macro; you can do the same for any task you want to accomplish in word.
Erik Moore
Clientelligence
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform