4D v17Using commands from the Styled Text theme |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v17
Using commands from the Styled Text theme
|
Command | Comments |
ST COMPUTE EXPRESSIONS | |
ST FREEZE EXPRESSIONS | |
ST GET ATTRIBUTES/ST SET ATTRIBUTES | |
ST Get content type | A new type (6) has been added for the image content type |
ST Get expression / ST INSERT EXPRESSION | Starting with 4D v16, expressions are filtered by default in 4D Write Pro documents and must be explicitely allowed. For more information, refer to the Filter expressions contained in a 4D Write Pro document section. Starting with 4D v16 R5, picture expressions can be inserted (see below). |
ST GET OPTIONS/ST SET OPTIONS | |
ST Get plain text/ST SET PLAIN TEXT | Starting with 4D v17, you can get/set plain text in 4D Write Pro documents with the WP Get text and WP SET TEXT commands. |
ST Get text / ST SET TEXT | |
ST GET URL / ST INSERT URL | Starting with 4D v16 R4, you can directly handle editable URLs in any 4D Write Pro range (including pictures and cells) using the WP SET ATTRIBUTES and WP GET ATTRIBUTES commands through the wk link url attribute. |
You want to replace the selection in a 4D Write Pro area with the contents of a variable:
C_TEXT(fullName)
Case of
:(Form event=On Clicked)
ST INSERT EXPRESSION(myArea;"fullName";ST Start highlight;ST End highlight)
End case
You can insert special expressions related to document attributes or page attributes using the ST INSERT EXPRESSION command.
Expression syntax | Availability | Type | Description |
$wp_title | all parts in the document | Text | Title defined in wk title attribute |
$wp_author | all parts in the document | Text | Author defined in wk author attribute |
$wp_subject | all parts in the document | Text | Subject defined in wk subject attribute |
$wp_company | all parts in the document | Text | Company defined in wk company attribute |
$wp_notes | all parts in the document | Text | Notes defined in wk notes attribute |
$wp_dateCreation | all parts in the document | Date | Date creation defined in wk date creation attribute |
$wp_dateModified | all parts in the document | Date | Date modified defined in wk date modified attribute |
$wp_pageNumber | Header & footer - error everywhere else | Longint | Page number as it is defined: from the document start (default) or from the section page start if it is defined by section page start |
$wp_pageCount | Header & footer - error everywhere else | LongInt | Page count : total count of pages |
To insert an expression, make sure the cursor is located in the appropriate area (header, footer, or document body) and call the ST INSERT EXPRESSION command. For example, to insert the page number in the selected footer area:
ST INSERT EXPRESSION(*;"4DWPArea";"$wp_pageNumber")
The following document design can be defined, for example:
You can insert 4D expressions that return pictures in your 4D Write Pro areas using the ST INSERT EXPRESSION command. Expressions can be variables, fields, or 4D methods(*).
(*)Keep in mind that calling a 4D method as an expression requires that the method has been explicitely allowed beforehand (see Filter expressions contained in a 4D Write Pro document).
Examples:
//Insert a picture variable
ST INSERT EXPRESSION(*;"WParea";"vPicture";ST Start highlight;ST End highlight)
//Insert a field
ST INSERT EXPRESSION(*;"WParea";"[DOC]SamplePict";ST Start highlight;ST End highlight)
//Insert a 4D method
ST INSERT EXPRESSION(*;"WParea";"M_ComputeChart";ST Start highlight;ST End highlight)
You can see the expression reference in the picture tip:
All image attributes can be applied to pictures expressions (wk image attribute can only be read). Note however that since pictures have specific attributes, 4D Write Pro must evaluate the expression at least once to detect that its result is a picture and handle it as a picture expression. It means that when a picture expression is inserted with ST INSERT EXPRESSION, ST COMPUTE EXPRESSIONS must be called before setting any picture attributes.
If the image resulting from the expression could not be computed or loaded, 4D Write Pro displays the default black frame image for undefined or not found url:
Product: 4D
Theme: 4D Write Pro Language
Modified: 4D v16
Modified: 4D v16 R5
4D Write Pro Reference ( 4D v17)