4D v17WP Create range |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v17
WP Create range
|
WP Create range ( targetObj ; startRange ; endRange ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
targetObj | Object |
![]() |
Range or element reference or 4D Write Pro document | |||||
startRange | Longint |
![]() |
Starting offset of range in the area | |||||
endRange | Longint |
![]() |
Ending offset of range in the area | |||||
Function result | Object |
![]() |
Range object | |||||
WP Create range was named WP Get range in previous versions of 4D Write Pro. It has been renamed for clarity.
The WP Create range command returns a new range object (rangeObj) containing the selection between startRange and endRange in the targetObj.
A 4D Write Pro range object can be used to handle attributes on a text selection (in particular with the WP GET ATTRIBUTES and WP SET ATTRIBUTES commands). For more information, refer to the Range handling commands paragraph.
You can pass in targetObj:
If no valid object is passed in the targetObj parameter, an empty rangeObj is returned.
In startRange and endRange, pass values corresponding to the position of the first and last characters to select in the document. You can pass wk start text in startRange to define the beginning of the document, and wk end text in endRange to define the end of the document. Keep in mind that a 4D Write Pro document not only contains visible text but also formatting tags that are included in the range.
If you passed a table, row, paragraph, inline picture, body, header or footer element reference in targetObj, startRange and endRange will be relative to the element range starting and ending index. For example, if a header is passed, wk start text designates the header starting character and wk end text the header ending character; if a table element reference is passed, the command will return a text range relative to the table referenced by targetObj.
Note: If you passed an element reference in targetObj, keep in mind that the returned range is relative to parent element contents. The range object always maintains an internal reference to the parent element.
You want to select a range of 12 characters starting from the beginning of the 4D Write Pro field. The field is displayed in a form object:
If you execute:
$range2:=WP Create range([SAMPLE]WP;wk start text;12)
WP SELECT(*;"WParea";$range2)
...the result is:
WP Get body
WP Get bookmark range
WP Get header
WP Get selection
WP SELECT
Product: 4D
Theme: 4D Write Pro Language
Number:
1341
Created: 4D v15 R4
Modified: 4D v16 R5
Renamed: 4D v16 R5
4D Write Pro Reference ( 4D v17)