ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Spreadsheet functions
  • Available masks
  • Defining a mask on a column
  • Miscellaneous
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Returns or modifies the type and the mask of selected cells in a Spreadsheet control found in a window.
Note This function can be used, for example, to create a formatting toolbar for a Spreadsheet control.
Example
// CLICK on [NUMBER] - Change of mask 
PSHEET_Spreadsheet.TypeAndMaskSelection(typInputNum, "999 999 999,99")

// CLIC on [Long DATE]. 
// Mask change: for example 19 -> "Sunday 19 January 1900"
PSHEET_Spreadsheet.TypeAndMaskSelection(typInputDate, "DDD D MMMM YYYY")
// Returns the selection mask
sRes is string 
nType is int
sMask is string
sRes = PSHEET_Spreadsheet.TypeAndMaskSelection()
nType = Val(ExtractString(sRes, 1, TAB))
sMask = Val(ExtractString(sRes, 2, TAB))
Syntax

Finding out the type and mask of selected cells Hide the details

<Result> = <Spreadsheet control>.TypeAndMaskSelection()
<Result>: Character string
Mask of selected cells. This mask has the following format:
<Type> + TAB + <Mask>
where:
  • <Type> corresponds to one of the following constants:
    typInputCurrencyCurrency type
    typInputDateDate type
    typInputDurationDuration type
    typInputNumNumeric type (integer, real, ...)
    typInputTextText type
    typInputTimeTime type
  • <Mask> corresponds to the mask used.
<Spreadsheet control>: Control name
Name of the Spreadsheet control to be used.

Modifying the type and mask of selected cells Hide the details

<Spreadsheet control>.TypeAndMaskSelection(<Type> , <Mask>)
<Spreadsheet control>: Control name
Name of the Spreadsheet control to be used.
<Type>: Integer constant
New type for the selected cell:
typInputCurrencyCurrency type
typInputDateDate type
typInputDurationDuration type
typInputNumNumeric type (integer, real, ...)
typInputTextText type
typInputTimeTime type
<Mask>: Character string
New mask to use (the mask depends on the selected type).
Remarks

Available masks

The available masks depend on the type of mask. All masks that can be used with InputMask are available. For more details, see the help on the InputMask property.
For example:
  • on a date: you can use the "DD/MM/YYYY" mask.
  • on a Numerical: you can use the "999 999" mask.
Remarks:
  • (typInputText, "") means "no mask".
  • The mask defined by <Spreadsheet>.TypeAndMaskSelection can be modified by InputMask.
    Warning: only the mask can be modified, the cell type is not modified..

Defining a mask on a column

To define a mask on a column, all you have to do is select the column and apply the requested mask. Example:
PSHEET_NoName1.SelectPlus("A")
PSHEET_NoName1.TypeAndMaskSelection(typInputDate, "DD-MM-YY")

Miscellaneous

  • The modification operation is added to the list of operations to be undone: the user can undo this operation via the context menu or by pressing Ctrl + Z.
  • This function can only be used on a Spreadsheet control found in a window.
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