| 4D v20WP New text box | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | 
    4D v20
 WP New text box 
         | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| WP New text box ( wpDoc ; pageNum ) -> Function result | ||||||||
| Parameter | Type | Description | ||||||
| wpDoc | Object |   | 4D Write Pro document | |||||
| pageNum | Number |   | Page number where to anchor the text box | |||||
| Function result | Object |   | Text box object | |||||
The WP New text box command creates and returns a new text box object in the page pageNum of wpDoc.
Note: For more information on text boxes, please refer to the Handling text boxes paragraph.
In the wpDoc parameter, pass a 4D Write Pro document.
In pageNum, pass the page number to which the text box must be anchored. It pageNum < 0 the page number 1 is used (no error is generated).
The command creates a new text box element with the following default attributes:
See the 4D Write Pro Attributes section for detailed description of these attributes. .
The new text box is rendered only on the page pageNum, so it may not be rendered if:
However, the text box still exists and is owned by the document even if not rendered.
You want to create a default, empty text box:
 $textBox:=WP New text box(WParea;1)Result:

In a template of a letter, you want to add a text box to display the address of the recipient (which is stored in the context):
  // #1 create the text box
 $textBox:=WP New text box(WParea;1)
 
  // #2 define some text box attributes
 WP SET ATTRIBUTES($textBox;wk id;"AddressArea")
 WP SET ATTRIBUTES($textBox;wk anchor origin;wk paper box)
 WP SET ATTRIBUTES($textBox;wk anchor horizontal align;wk left;wk vertical align;wk top)
 WP SET ATTRIBUTES($textBox;wk anchor horizontal offset;$form.offsetX.values[$form.offsetX.index])
 WP SET ATTRIBUTES($textBox;wk anchor vertical offset;$form.offsetY.values[$form.offsetY.index])
 WP SET ATTRIBUTES($textBox;wk width;$form.width.values[$form.width.index])
 WP SET ATTRIBUTES($textBox;wk height;$form.height.values[$form.height.index])
 WP SET ATTRIBUTES($textBox;wk padding;$form.padding.values[$form.padding.index]) // inside margins
 WP SET ATTRIBUTES($textBox;wk border style;wk dashed;wk border color;"Blue";wk border width;"1pt";wk border radius;"10pt")
 WP SET ATTRIBUTES($textBox;wk vertical align;wk center)
 
  // #3: define the formulas inside the text box
 WP INSERT FORMULA($textBox;Formula(This.data.fullName);wk append)
 WP INSERT BREAK($textBox;wk paragraph break;wk append)
 WP INSERT FORMULA($textBox;Formula(This.data.fullAddress);wk append)
 
  // #4: Style the content of the text box
 WP SET ATTRIBUTES($textBox;wk font;"Arial";wk font bold;wk true;wk font size;"18pt")Result:

	Product:  4D
	Theme:  4D Write Pro Language
	Number:  
        1797
        
        
        
	
	Created:  4D v19 R8
	
	4D Write Pro Reference ( 4D v20)
	
	
	
 Add a comment
Add a comment