Altova XMLSpy 2024 Enterprise Edition

Property: FirstXMLDataOffset as Long

 

Description

Set or get the cursor position offset inside FirstXMLData element for the beginning of the range. Offset positions are based on the characters returned by the Text property, and start with 0. When setting a new offset, use -1 to set the offset to the last possible position in the element. The following cases require specific attention:

 

The textual form of entries in Combo Boxes, Check Boxes and similar controls can be different from what you see on screen. Although the data offset is based on this text, there only two valid offset positions, one at the beginning and one at the end of the entry. An attempt to set the offset to somewhere in the middle of the entry, will result in the offset being set to the end.

 

The textual form of XML Entities might differ in length from their representation on the screen. The offset is based on this textual form.

 

If FirstXMLData / FirstXMLDataOffset selects a position after the current LastXMLData / LastXMLDataOffset, the latter gets moved to the new start position.

 

Errors

2001

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

2005

Invalid offset was specified.

Invalid address for the return parameter was specified.

 

Examples

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

' Scripting environment - VBScript

' Select the complete text of an XMLData element

' using XMLData based selection and ExpandTo

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

Dim objAuthenticView

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

Set objAuthenticView = Application.ActiveDocument.AuthenticView

 

' first we use the XMLData based range properties

' to select all text of the first XMLData element

' in the current selection

Dim objRange

Set objRange = objAuthenticView.Selection

objRange.FirstXMLDataOffset = 0  ' start at beginning of element text

objRange.LastXMLData = objRange.FirstXMLData  ' select only one element

objRange.LastXMLDataOffset = -1  ' select till its end

 

' the same can be achieved with the ExpandTo method

Dim objRange2

Set objRange2 = objAuthenticView.Selection.ExpandTo(spyAuthenticTag)

 

' were we successful?

If objRange.IsEqual(objRange2) Then

 objRange.Select()

Else

 MsgBox "Oops"

End If

© 2017-2023 Altova GmbH