This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20
WP Get text

WP Get text 


 

WP Get text ( targetObj {; expressions} ) -> Function result 
Parameter Type   Description
targetObj  Object in Range or element or 4D Write Pro document
expressions  Number in Instructions for expression evaluation
Function result  Text in 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:

  • a range, or
  • an element ( table / paragraph / body / header / footer / section / subsection), or
  • a 4D Write Pro document

Notes: 

  • If you pass a 4D Write Pro document in targetObj, the command only returns the text from the body element of the document. 
  • If you pass a subsection in targetObj, the command returns the text of the parent section.

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:

  • If targetObj contains pictures, the pictures are ignored and returned as space characters (" ").
  • If targetObj contains tables, the content of each cell is treated as individual paragraphs and returned as text separated by tabs. Rows are separated by carriage returns.

Example  

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:  ."



See also 

Managing formulas
WP SET TEXT

 
PROPERTIES 

Product: 4D
Theme: 4D Write Pro Language
Number: 1575

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v17
Modified: 4D v17 R3

 
ARTICLE USAGE

4D Write Pro Reference ( 4D v20)