4D v17WP Add picture |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v17
WP Add picture
|
WP Add picture ( wpDoc ; picture ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
wpDoc | Object |
![]() |
4D Write Pro document | |||||
picture | Picture, Text |
![]() |
Picture (field or variable) or Picture path (text) | |||||
Function result | Object |
![]() |
Object referencing the picture | |||||
The WP Add picture command anchors picture at a fixed location within the wpDoc and returns its reference. The returned reference can then be passed to the WP SET ATTRIBUTES command to move picture to any location in wpDoc (page, section, header, footer, etc.) with a defined layer, size, etc.
In wpDoc, pass the name of a 4D Write Pro document object.
In picture, you can pass:
Note: Any picture format supported by 4D can be used (see the Pictures section). You can get the list of available picture formats using the PICTURE CODEC LIST command. If the picture encapsulates several formats (codecs), 4D Write Pro only keeps one format for display and one format for printing (if different) in the document; the "best" formats are automatically selected.
By default, the added picture is:
The location, layer (inline, in front/behind text), visibility, and any properties of picture can be modified using the WP SET ATTRIBUTES command, or via standard actions (see Using 4D Write Pro standard actions).
Note: The WP Get selection command returns a picture reference object if a an anchored picture is selected and a range object if an inline picture is selected. You can check if a selected object is a picture object with the wk type attribute. If the value = 2, then it is a picture object, otherwise it is a range object (value = 0).
You want to add a picture with default settings using a filepath.
C_OBJECT($obPict)
$obPict:=WP Add picture(myDoc;"C:\\Users\\John.Doe\\Pictures\\Sunrise.jpg")
The result is:
You want to add a resized picture, centered and anchored to the header:
C_OBJECT($obImage)
$obImage:=WP Add picture(myDoc;"C:\\Users\\John.Doe\\Pictures\\Saved Pictures\\Sunrise.jpg")
WP SET ATTRIBUTES($obImage;wk anchor origin;wk header box)
WP SET ATTRIBUTES($obImage;wk anchor horizontal align;wk center)
WP SET ATTRIBUTES($obImage;wk anchor vertical align;wk center)
WP SET ATTRIBUTES($obImage;wk width;"650px";wk height;"120px")
The result is:
Product: 4D
Theme: 4D Write Pro Language
Number:
1536
Created: 4D v16 R6
4D Write Pro Reference ( 4D v17)