Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserting Text in Word Document
Message
From
10/10/2001 14:43:58
 
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00566173
Message ID:
00566592
Views:
10
>Don,
>How are you putting the text into your document? have you tried putting it into the clipboard?
>store mytable.thismemofield to _cliptext


Well, I am using the EXECUTE() method of the FIND object.


As in ...

cDataDate = dtoc(date())
oWord = CreateObject("Word.Application")
oWord.visible = .t.
oDocument = oWord.Documents.Add("Tap.dot")

oRange = oDocument.Range

with oRange.Find
.Text = "" && The text we are to FIND
.Replacement.Text = cDataDate && The text to replace it with
.Execute(,,,,,,,,,,wdReplaceAll) && Do it throughout document
endwith

Now this works find as long as the text you are replacing it with has less
than 255 characters.


For over 254 characters I have devised this little scheme which works but
may certainly be classified as a 'grunge'.

cSecondaryRecommendations = alltrim(recommends) && contents of a memo field
cText = ""
nMax = len(cRecommendations)
nSpot = 1
do while .t.
.Text = cText
cReplacementText = substr(cRecommendations,nSpot,250)
.Replacement.Text = cReplacementText
.Execute(,,,,,,,,,,wdReplaceAll)
nSpot = nSpot + 200
if nSpot > nMax
exit
endif
cText = right(cReplacementText,50)
enddo
endwith
Previous
Reply
Map
View

Click here to load this message in the networking platform