This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
WP Table insert columns

WP Table insert columns 


 

WP Table insert columns ( targetObj | {tableRef ; colNumber} {; numColumns} ) -> Function result 
Parameter Type   Description
targetObj  Object in Range or element or 4D Write Pro document
tableRef  Object in Table reference
colNumber  Longint in Column number
numColumns  Longint in Number of columns to insert (default value = 1)
Function result  Object in Range of table columns

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 targetObj does not intersect with a table or text range where columns can be inserted, the command does nothing and returns Null (no error is generated). 
  • 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 colNumber 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:

 C_OBJECT($column)
 C_OBJECT($table)
 
 $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:



See also 

WP Table insert rows

 
PROPERTIES 

Product: 4D
Theme: 4D Write Pro Language
Number: 1692

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v18

 
ARTICLE USAGE

4D Write Pro Reference ( 4D v20 R7)