Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Positioning the cursor
Message
De
04/10/2011 17:56:49
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 5
OS:
Windows 7
Divers
Thread ID:
01525412
Message ID:
01525588
Vues:
51
>>>>Hi All:
>>>>
>>>>In the following snippet:
>>>>
>>>>
>>>>		loDoc = .oWord.documents.OPEN(tcDocument)
>>>>		
>>>>		lcText = gc_sdate8 + ' ' + alltrim(gc_userid) + ':' + chr(13) + chr(13)
>>>>
>>>>		loRange = loDoc.Range()
>>>>		loRange.InsertBefore(lcText)
>>>>		
>>>>		.oWord.VISIBLE = .T.
>>>>
>>>>		.oword.WINDOWSTATE = wdWindowStateMinimize
>>>>		.oword.WINDOWSTATE = wdWindowStateMaximize && this automatically makes the window activated
>>>>
>>>>
>>>>Ths cursor is positioned BEFORE the inserted text. How do I position it AFTER the inserted text?
>>>>
>>>>Thanks,
>>>>
>>>>Yossi
>>>
>>>
>>>Something like this?
>>>
>>>#define wdCollapseEnd 0 
>>>#define wdCharacter   1
>>>oWord = CREATEOBJECT([Word.Application])
>>>
>>>loDoc = oWord.documents.OPEN(GETFILE())
>>>oWord.VISIBLE = .T.
>>>lcText = gc_sdate8 + ' ' + alltrim(gc_userid) + ':' + chr(13) + chr(13)
>>>loRange = loDoc.Range()
>>>loRange.Collapse(wdCollapseEnd)
>>>loRange.MoveEnd(wdCharacter, -1 )
>>>oWord.Selection.TypeText(lcText)
>>>
>>
>>Borislav:
>>
>>I'm embarrassed that I can't get it right. We're almost there.
>>
>>Before the operation, the document looks like this:
>>
>>
>>Line 1
>>Line 2
>>
>>
>>After the operation, it looks like this:
>>
>>
>>10/3/11 SHIM:
>>
>>Line 1
>>Line 2
>>
>>
>>The problem is that the cursor is now positioned before the 'L' of 'Line 1'. I want it to be positioned at the beginning of the blank line i.e. before the 2nd chr(13) of the inserted text. My knowledge of automating word is not there. Can you help me?
>
>
>
>#define wdCollapseEnd 0 
>#define wdCharacter   1
>oWord = CREATEOBJECT([Word.Application])
>
>loDoc = oWord.documents.OPEN(GETFILE())
>oWord.VISIBLE = .T.
>lcText = gc_sdate8 + ' ' + alltrim(gc_userid) + ':'+CHR(13)
>loRange = loDoc.Range()
>loRange.InsertParagraphBefore()
>loRange.Collapse(wdCollapseEnd)
>loRange.MoveEnd(wdCharacter, -1 )
>oWord.Selection.TypeText(lcText)
>
Thanks! That worked.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform