Hi,
When i instert text in a word document (oWrd:Selection():TypeText("Text to be inserted") , how is it possible to read the vertical or horizontal position in the active page ?
Thanks for your help .
Philippe
Reading active position the page in a Word-document
Re: Reading active position the page in a Word-document
Hello Jack,
try this
Regards,
Massimo
try this
Code: Select all
#include "FiveWin.ch"
#define wdHorizontalPositionRelativeToPage 5
#define wdVerticalPositionRelativeToPage 6
#define wdDoNotSaveChanges 0
FUNCTION MAIN()
LOCAL oWord, oDoc, oSelection, x, y
TRY
oWord := TOleAuto():New( "Word.Application" )
CATCH
oWord := NIL
END
IF oWord <> NIL
oDoc := oWord:Documents:Add()
oWord:Visible := .T.
oSelection := oWord:Selection()
oSelection:TypeText( "This is my text in Word!" )
x := oSelection:Range:Information( wdVerticalPositionRelativeToPage )
y := oSelection:Range:Information( wdHorizontalPositionRelativeToPage )
oWord:Visible := .F.
oDoc:Close( wdDoNotSaveChanges )
oWord:Quit()
MsgStop( ALLTRIM( STR( x ) ) + ", " + ALLTRIM( STR( y ) ) )
ENDIF
RETURN NIL
Massimo
Re: Reading active position the page in a Word-document
Thanks a lot for this help .
Philippe
Philippe