This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20
WP Get text
|
WP Get text ( targetObj {; expressions} ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
targetObj | Object |
![]() |
Range or element or 4D Write Pro document | |||||
expressions | Number |
![]() |
Instructions for expression evaluation | |||||
Function result | Text |
![]() |
Text of targetObj | |||||
The WP Get text command retrieves text contents from a 4D Write Pro document within the specified targetObj.
WP Get text returns plain text only. Any applied styles (bold, italics, etc.) will be ignored.
In the targetObj parameter, pass an object containing either:
Notes:
The optional expressions parameter provides instructions for the evaluation of 4D expressions within the targetObj (for more information, refer to the Managing formulas page). The options are:
Constant | Comment |
wk expressions as source | The original string of 4D expression references is returned. |
wk expressions as space | Each reference is returned as a non-breaking space character. |
wk expressions as value | 4D expression references are returned in their evaluated form. (default if option if not passed). |
Important: Only plain text with wk expressions as space is consistent with text range indexes used by WP or ST commands, as WP and ST commands always assume the size of expression=1 character.
Notes:
To retrieve the text in this document:
you can write:
$range:=WP Text range(myDoc2;wk start text;wk end text)
vText:=WP Get text($range;wk expressions as value) //returns "Hello world! Today is: 06/03/18."
vText2:=WP Get text($range;wk expressions as source) //returns "Hello world! Today is: Current date."
vText3:=WP Get text($range;wk expressions as space) //returns "Hello world! Today is: ."
Product: 4D
Theme: 4D Write Pro Language
Number:
1575
Created: 4D v17
Modified: 4D v17 R3
4D Write Pro Reference ( 4D v20)