This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
WP SET TEXT
|
WP SET TEXT ( targetObj ; newText ; textPosition {; rangeUpdate} ) | ||||||||
Parameter | Type | Description | ||||||
targetObj | Object |
![]() |
Range or element or 4D Write Pro document | |||||
newText | Text |
![]() |
Text to insert | |||||
textPosition | Number |
![]() |
Insertion position (replace, before, after) | |||||
rangeUpdate | Number |
![]() |
Includes or excludes the inserted content within the range | |||||
The WP SET TEXT command inserts the text passed in the newText parameter as plain text in the targetObj at the position designated by the textPosition parameter.
In the targetObj parameter, pass an object to designate the position where text will be inserted. It can be an explicit location in the 4D Write Pro document or it can be based on a user's selection. You can pass:
The newText parameter contains the text to be inserted within targetObj. WP SET TEXT inserts plain text only, exactly as its written, but without any style tags.
In the textPosition parameter, the location of the inserted text can be specified by passing one of the following selectors:
Constant | Comment |
wk append | Insert contents at end of target |
wk prepend | Insert contents at beginning of target |
wk replace | Replace target contents |
Constant | Comment |
wk exclude from range | Inserted contents not included in updated range |
wk include in range | Inserted contents included in updated range (default) |
You want to to add text to this document:
targetObj is a 4D Write Pro document:
WP SET TEXT(myDoc;"Hello world";wk append)
//writes "The quick brown fox jumps over the lazy dog. Hello world!"
targetObj is a range:
Before the existing text:
$range:=WP Text range(myDoc;wk start text;wk end text)
WP SET TEXT($range;" Hello world!";wk prepend)
//writes " Hello world! The quick brown fox jumps over the lazy dog."
After the existing text:
$range:=WP Text range(myDoc;wk start text;wk end text)
WP SET TEXT($range;" Hello world!";wk append)
//writes "The quick brown fox jumps over the lazy dog. Hello world!"
Replace the existing text:
$range:=WP Text range(myDoc;wk start text;wk end text)
WP SET TEXT($range;" Hello world!";wk replace)
//writes " Hello world!"
Product: 4D
Theme: 4D Write Pro Language
Number:
1574
Created: 4D v17
Modified: 4D v17 R5
4D Write Pro Reference ( 4D v20 R7)