ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Spreadsheet functions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Adds a calculation formula into a Spreadsheet control found in a window.
Example
//  Initialisation de la 1ère colonne et avec des nombres de 1 à 10
FOR I = 1 TO 10
	TBLR_Tableur.AjouteDonnée(1, I, "Ligne " + I)
END

TBLR_Tableur.AjouteDonnée(1, 1, 13)
TBLR_Tableur.AjouteDonnée(1, 2, 20)
TBLR_Tableur.AjouteFormule(1, 3, "A1+A2/2") // Affiche 23
TBLR_Tableur.AjouteFormule("A4", "A1+A2")
TBLR_Tableur.AjouteDonnée(1, 2, 33) // Affiche 33 dans la case A3
Syntax

Adding a formula into a cell identified by its coordinates Hide the details

<Spreadsheet control>.AddFormula(<Column> , <Row> , <Formula>)
<Spreadsheet control>: Control name
Name of the Spreadsheet control to be used.
<Column>: Integer
Column number of the cell containing the formula.
<Row>: Integer
Row number of the cell containing the formula.
<Formula>: Character string
Formula to add. The first "=" character must not be included in the formula. For example: "A1+B2-A2"
In case of syntax error or invalid identifier, "###" is displayed in the cell and a non-fatal error is displayed.

Adding a formula into a cell identified by its name Hide the details

<Spreadsheet control>.AddFormula(<Cell name> , <Formula>)
<Spreadsheet control>: Control name
Name of the Spreadsheet control to be used.
<Cell name>: Character string
Name of the cell to be used. For example: "A4".
<Formula>: Character string
Formula to add. The first "=" character must not be included in the formula. For example: "A1+B2-A2"
In case of syntax error or invalid identifier, "###" is displayed in the cell and a non-fatal error is displayed.
Remarks
  • If the cell (Column, Row) does not exist, the cell is created.
  • If the cell (Column, Row) already exists, the content is deleted. It is replaced with the <Formula> formula.
  • This function can only be used on a Spreadsheet control found in a window.
  • The cells can be renamed (<Spreadsheet>.AddName). You have the ability to use the name of a cell in the formula.
Related Examples:
The Spreadsheet control Unit examples (WINDEV): The Spreadsheet control
[ + ] Using the Spreadsheet control.
This example explains how to:
- load an xlsx file in a spreadsheet control,
- save the spreadsheet in a file,
- fill the control with data coming from the database,
- insert rows, columns,
- access the cells and handle them (modify their value, their style, ...),
- enter formulas,
- ...
Component: wd300obj.dll
Minimum version required
  • Version 23
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/20/2024

Send a report | Local help