Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Select a variable range in Word
Message
De
19/03/2004 20:38:14
Peter Wagner
Point Informática Ltda.
Limeira, Brésil
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
How to Select a variable range in Word
Divers
Thread ID:
00888137
Message ID:
00888137
Vues:
61
Im building many different strings in VFP (VFP_VAR1,VFP_VAR2,... ) and replacing it in Word.
The string looks something like this:
"a) Entrada de R$ %2.816,52 (Dois Mil Oitocentos e Dezesseis Reais e
Cinqüenta e Dois Centavos )%% em %2 (Duas )%% parcelas %NÃO REAJUSTÁVEIS e SEM
JUROS%%, sendo  a  primeira no valor de R$ %1.408,26%% no dia %15/03/2004%%, e a
segunda no valor de R$ %1.408,26%% no dia %15/04/2004%%"
Im replacing the text in Word this way..
LOCAL oWord AS "Word.Application"
IF TYPE("oWord") <> "O"
	oWord = CREATEOBJECT("Word.Application")
ENDIF

oWord.VISIBLE = .F.
loSelection = oWord.ActiveWindow.ActivePane.SELECTION
loSelection.FIND.ClearFormatting()

WITH loSelection.FIND
	.TEXT              = "@@TEXT1"
	.Replacement.TEXT  = ""
	.Forward           = .T.
	.WRAP              = wdFindContinue
	.FORMAT            = .F.
	.MatchCase         = .F.
	.MatchWholeWord    = .F.
	.MatchWildcards    = .F.
	.MatchSoundsLike   = .F.
	.MatchAllWordForms = .F.
ENDWITH

loSelection.FIND.TEXT  = "@@TEXT1"
loSelection.FIND.Execute()
loSelection.TypeText(TRIM(VFP_VAR1))
loSelection.GOTO(3,1,1)
So far its Ok, but after replacing those strings in Word I need to select ranges in those string where it starts with "%" and ends with "%%" to Format the text between "%" and "%%" to BOLD, and later remove "%" and "%%" from the document.

Does someone knows how to select variable ranges in Word to do this ?

Thanks in Advance

Peter
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform