WP Table insert columns
WP Table insert columns ( targetObj | {tableRef ; colNumber} {; numColumns} ) : Object
Parameter | Type | Description | |
---|---|---|---|
targetObj | Object | → | Range or element or 4D Write Pro document |
tableRef | Object | → | Table reference |
colNumber | Integer | → | Column number |
numColumns | Integer | → | Number of columns to insert (default value = 1) |
Function result | Object | ← | Range of table columns |
Description
The WP Table insert columns command inserts one or several column(s) into a 4D Write Pro table.
This command supports two syntaxes:
- If you pass a targetObj as the first parameter, the command will insert the column(s) in the first table intersecting the target. targetObj can contain:
- a range, or
- an element (row / paragraph / body / header / footer / inline picture / section / subsection), or
- a 4D Write Pro document.
- If you pass both a tableRef and a colNumber as parameters, the command will insert the column(s) in the designated table and at the specified column index. If the col Number is higher than the number of columns in tableRef, the columns are appended to the table rather than inserted.
The optional numColumns parameter defines the number of columns to insert into targetObj or tableRef. By default, if this parameter is omitted, one column is inserted.
Result
The command returns a column range representing inserted column(s), or Null if nothing was inserted.
Example
You want to insert three columns after first column in the Invoice table. This code:
var $column : Object
var $table : Object
$table:=WP Get element by ID(WParea;"Invoice") //retrieve "Invoice" table
$column:=WP Table insert columns($table;2;3) //position 2, add 3 columns
Will insert the new columns at the correct location: