WP Table append row
WP Table append row ( tableRef ; ...value )  : Object
WP Table append row ( tableRef ; valueColl ) : Object
| Paramètres | Type | Description | |
|---|---|---|---|
| tableRef | Object | → | Référence du tableau | 
| value | Text, Number, Time, Date, Picture, Object | → | Valeur(s) à définir dans la ligne | 
| valueColl | Collection | → | Collection de valeurs à définir dans la ligne | 
| Résultat | Object | ← | Objet plage ligne | 
Description
The WP Table append row command appends one row to the tableRef table, fills it with value(s) or a valueColl collection, and returns the corresponding row range object.
The command supports two syntaxes:
- 
Using values as parameters: Adds as many cells in the row as there are values provided in the value parameter(s). You can pass any number of values of different types. 
- 
Using a collection of values (valueColl): Fills the row with values from the valueColl collection. Each element of the collection corresponds to a cell in the row. The following value types are supported in both syntaxes: Text, Number, Time, Date, Picture and Object (formulas or named formulas returning a row element). 
The default cell alignment will depend on the value type:
- text: left aligned
- pictures: centered
- other types (numbers, date, and time): right aligned
- Array type values are not supported.
- Ensure the number of values or the size of the collection matches the number of cells in the table to avoid unexpected results.
The command returns the new row as a row range object.
Exemple 1
Vous voulez créer une table vide et ajouter plusieurs lignes de différentes tailles. Vous pouvez écrire :
 var $wpTable;$wpRange;$wpRow1;$wpRow2;$wpRow3 : Object
 $wpRange:=WP Text 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;"New!")
Exemple 2
Vous voulez créer une table vide et ajouter une ligne en utilisant une collection :
$table:=WP Insert table(WParea; wk replace; wk include in range)
$row:=WP Table append row($table; "Reference"; "Date"; "Time"; "rnd 1"; "rdn 2")
WP SET ATTRIBUTES($row; wk background color; "lightgrey")
$colItems:=[]
$colItems.push("KX-825")
$colItems.push(Formula(Current date))
$colItems.push(Formula(String(Current time; HH MM SS)))
$colItems.push(Formula(Random))
$colItems.push({name: "RND NUMBER"; formula: Formula(Random)})
$row:=WP Table append row($table; $colItems)
Exemple 3
Dans une application de facturation, vous souhaitez créer un tableau automatiquement rempli avec les lignes de facture correspondantes :
 var $wpTable;$wpRange : Object
 
 $wpRange:=WP Text range(4DWPArea;wk start text;wk end text)
 
 $wpTable:=WP Insert table($wpRange;wk append) //créer le tableau
 
  // ajouter la ligne d'en-tête
 $row:=WP Table append row($wpTable;"Name";"Quantity";"Unit Price";"Discount Rate";"Total")
 WP SET ATTRIBUTES($row;wk font bold;wk true;wk text align;wk center)
 
  //simplement appliquer à la sélection
 APPLY TO SELECTION([INVOICE_LINES];WP Table append row($wpTable;[INVOICE_LINES]ProductName;[INVOICE_LINES]Quantity;[INVOICE_LINES]ProductUnitPrice;[INVOICE_LINES]DiscountRate;[INVOICE_LINES]Total))
 
  //ajouter une ligne de pied de page
 $row:=WP Table append row($wpTable;"Total:";Sum([INVOICE_LINES]Quantity);"";"";Sum([INVOICE_LINES]Total))
 
  //formater le tableau
 $range:=WP Table get columns($wpTable;1;5)
 WP SET ATTRIBUTES($range;wk width;"80pt")
 WP SET ATTRIBUTES($wpTable;wk font size;10)
