This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
WP Get element by ID
|
WP Get element by ID ( wpDoc ; ID ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
wpDoc | Object |
![]() |
4D Write Pro document | |||||
ID | String |
![]() |
Identifier of the element to retrieve | |||||
Function result | Object |
![]() |
4D Write Pro element | |||||
The WP Get element by ID command returns an object containing the element of wpDoc passed in the ID parameter.
In the wpDoc parameter, pass a 4D Write Pro document.
Pass the ID attribute of the element to retrieve in the ID parameter. The element can be within the document, such as an image, a paragraph, a table, row, etc., or the document itself. If no elements in the document have the specified ID, a null value is returned.
Note: The ID parameter value is case-sensitive.
To get the picture with the ID "img1":
C_OBJECT(obImage)
obImage:=WP Get element by ID(myDoc;"img1")
You want to find a table element and modify it to have a large purple border:
C_OBJECT($element)
$element:=WP Get element by ID(myDoc;"Table1")
WP SET ATTRIBUTES($element;wk border style;wk solid)
WP SET ATTRIBUTES($element;wk border width;"4px")
WP SET ATTRIBUTES($element;wk border color;"purple")
You want to retrieve an element and modify its ID:
$colTable:=WP Create table range([INFO]Sample)
$elements:=WP Get elements($colTable)
$elem:=WP Get element by ID([INFO]Sample;"Paris")
If($elem#Null)
$elem.ID:="Lyon"
End if
Product: 4D
Theme: 4D Write Pro Language
Number:
1549
Created: 4D v17
4D Write Pro Reference ( 4D v20 R7)