PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → turtorial exampel controlling word
turtorial exampel controlling word
Iniciado por guest, 11,jun. 2015 20:53 - 6 respuestas
Publicado el 11,junio 2015 - 20:53
hello,
this weekend i had a look at the exampel controling word....the features looked promising,..
find/replace...write line...
however for my purpose i need to go to a certain position and write a textline i also need a way to retrieve at what position the cusor stands(in the controlled word doc)...however in the Cword class that is provided there is no function to do this (in my case find / replace just issent enough).

any help is appreciated
thanks in advance
Publicado el 11,junio 2015 - 21:18
Hi

the usual way of doing these things is as follow:
- in word, start recording a macro
- do what you need to do (by example "go to a certain position and write a textline ")
- stop the macro
- edit the macro and TRANSLATE the VBA code into wlanguage

Best regards
Publicado el 11,junio 2015 - 22:30
would running a macro recordit on 1 pc work on another?with difrent screen reolution/changed desktop gui?

is this what the Cword clas does when it uses string replace?
Publicado el 12,junio 2015 - 14:44
Hi again
yes, a macro recorded on one pc would work on another...

no, it doesn't USE a macro, it uses wlanguage code that matches (has been translated) from the corresponding functions in VBA

Best regards
Publicado el 12,junio 2015 - 19:11
Word offers document variables. You can put these variables wherever you need to insert stuff into a document. You can then use COM automation to replace the variable with whatever text. I have used this technique for generating insurance policies since 1997 with Visual Foxpro as the driver program. I'm very confident WinDev could accomplish the same thing. It's a fully programmed control mail merge. Unfortunately I do not have the exact method of the COM object to call available to me but it exits and works very reliably.

Stewart Crisler
Publicado el 12,junio 2015 - 22:10
after some search i found the folowing code
however i seem to have some issues on translating it in W5
how can i make a class of it ?

Const wdStory = 6 Const wdMove = 0 Set objWord = CreateObject("Word.Application") objWord.Visible = True Set objDoc = objWord.Documents.Open("c:\scripts\ estdoc.doc") Set objSelection = objWord.Selection objSelection.EndKey wdStory, wdMove objSelection.TypeParagraph() objSelection.TypeParagraph() objSelection.TypeText "This text was appended to an existing Word document."
source
Publicado el 13,junio 2015 - 19:27
no one who knows how i can translate this vba code to W5,?