This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
WP Table get cells
|
WP Table get cells ( targetObj ) | ( tableRef ; startCol ; startRow {; numCols{; numRows}} ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
targetObj | Object |
![]() |
Range or element or 4D Write Pro document | |||||
tableRef | Object |
![]() |
Table reference | |||||
startCol | Longint |
![]() |
Position of first cell column | |||||
startRow | Longint |
![]() |
Position of first column row | |||||
numCols | Longint |
![]() |
Number of columns to get | |||||
numRows | Longint |
![]() |
Number of rows to get | |||||
Function result | Object |
![]() |
New range containing cells | |||||
The WP Table get cells command returns a new cell range object containing the selection of cells in the targetObj or tableRef (defined by startCol, startRow, numCols, and numRows).
Pass either:
If targetObj does not intersect with a table or text range where a selection of cells can be retrieved, the command returns Null.
OR
If startCol plus numCols or startRow plus numRows exceeds the number of columns/rows in tableRef, or if startCol or startRow is greater than the number of columns/rows in tableRef, the returned range contains the maximum possible columns/rows.
You want to modifiy the attributes of a range of cells:
C_OBJECT($wpTable;$wpRange;$wpRow1;$wpRow2;$wpRow3;$wpRow4;$wpRow5;$cells)
$wpRange:=WP Create range(WParea;wk start text;wk end text)
$wpTable:=WP Insert table($wpRange;wk append)
$wpRow1:=WP Table append row($wpTable;"Paul";"Smith";25)
$wpRow2:=WP Table append row($wpTable;"John";"Richmond";40)
$wpRow3:=WP Table append row($wpTable;"Mary";"Trenton";18)
$wpRow4:=WP Table append row($wpTable;"Christopher";"Lee";53)
$wpRow5:=WP Table append row($wpTable;"Henry";"Cartier";42)
$cells:=WP Table get cells($wpTable;2;2;2;2)
WP SET ATTRIBUTES($cells;wk background color;0x00E0E0E0)
WP SET ATTRIBUTES($cells;wk text color;"blue")
WP SET ATTRIBUTES($cells;wk border color;0x00E000E0)
WP SET ATTRIBUTES($cells;wk text align;wk center)
Result:
To get a range of cells starting from the cell "5x7" to the end of the row:
$cellRange:=WP Table get cells(tableRef;5;7;MAXLONG;1)
To get a range of cells starting from the cell "5x7" to the end of the column:
$cellRange:=WP Table get cells(tableRef;5;7;1;MAXLONG)
To get a range of cells starting from the cell "5x7" to the end of the table:
You want to retrieve the cells a user has selected:
C_OBJECT($userSelection;$cells)
$userSelection:=WP Selection range(myWPArea)
$cells:=WP Table get cells($userSelection)
Product: 4D
Theme: 4D Write Pro Language
Number:
1477
Created: 4D v16 R4
Modified: 4D v17
Modified: 4D v18
4D Write Pro Reference ( 4D v20 R7)