Altova StyleVision 2023 Enterprise Edition

Property: FirstTextPosition as Long

 

Description

Set or get the left-most text position index of the range object. This index is always less or equal to LastTextPosition. Indexing starts with 0 at document beginning, and increments with every different position that the text cursor can occupy. Incrementing the test position by 1, has the same effect as the cursor-right key. Decrementing the test position by 1 has the same effect as the cursor-left key.

 

If you set FirstTextPosition to a value greater than the current LastTextPosition, LastTextPosition gets set to the new FirstTextPosition.

 

HINT: Use text cursor positions with care, since this is a costly operation compared to XMLData based cursor positioning.

 

Errors


2001

The authentic range object, or its related view object is not valid.


2005

Invalid address for the return parameter was specified.


2006

A text position outside the document was specified.

 

Examples

' ---------------------------------------

' Scripting environment - VBScript

' ---------------------------------------

Dim objAuthenticView

' we assume that the active document is open in authentic view mode

Set objAuthenticView = Application.ActiveDocument.AuthenticView

 

nDocStartPosition = objAuthenticView.DocumentBegin.FirstTextPosition

nDocEndPosition = objAuthenticView.DocumentEnd.FirstTextPosition

 

' let's create a range that selects the whole document

' in an inefficient way

Dim objRange

' we need to get a (any) range object first

Set objRange = objAuthenticView.DocumentBegin

objRange.FirstTextPosition = nDocStartPosition

objRange.LastTextPosition = nDocEndPosition

 

' let's check if we got it right

If objRange.isEqual(objAuthenticView.WholeDocument) Then

 MsgBox "Test using direct text cursor positioning was ok"

Else

 MsgBox "Ooops!"

End If

© 2017-2023 Altova GmbH