Allows the use of a WLanguage procedure in a formula of a Spreadsheet control.
Remark: By default, the WLanguage procedures are not allowed in the formulas for security reasons. Indeed, a malicious user could for example call an initialization procedure that resets all data files to 0.
// Allows the CalculateVAT() procedure in the formulas
PSHEET_Spreadsheet.AllowProcedure("CalculateVAT" + CR + "MaxPrice" + CR + "MinPrice")
PSHEET_Spreadsheet.AddFormula(2,1, "(MaxPrice() + MinPrice())/2")
<Spreadsheet control>.AllowProcedure(<WLanguage procedure>)
<Spreadsheet control>: Control name
Name of the Spreadsheet control to be used.
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure that is allowed in a formula. This procedure can be a local or global procedure.
To specify several procedures, the names must be separated by a CR character (Carriage Return).
This procedure must return the value to display in the cell using the formula.
- Caution: If a WLanguage procedure is allowed, this procedure will be displayed in the list of formulas proposed to the user. Therefore, the end user will be able to use this procedure. Don't forget to provide a documentation about the possible formulas and expected parameters.
- This function can only be used on a Spreadsheet control found in a window.
Unit examples (WINDEV): The Spreadsheet control