- Available masks
- Defining a mask on a column
- Miscellaneous
SpreadsheetTypeAndMaskSelection (Function) In french: TableurTypeEtMasqueSélection Returns or modifies the type and the mask of selected cells in a Spreadsheet control found in a window. Remark: This function can be used for example to create a formatting bar for a Spreadsheet control.
// CLICK on [NUMBER] - Change of mask SpreadsheetTypeAndMaskSelection(PSHEET_Spreadsheet, typInputNum, "999 999 999,99") // CLIC on [Long DATE]. // Change of mask: for example 19 -> "Sunday 19 January 1900" SpreadsheetTypeAndMaskSelection(PSHEET_Spreadsheet, typInputDate, "DDD D MMMM YYYY")
// Returns the selection mask sRes is string nType is int sMask is string sRes = SpreadsheetTypeAndMaskSelection(PSHEET_Spreadsheet) 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> = SpreadsheetTypeAndMaskSelection(<Spreadsheet control>)
<Result>: Character string Mask of selected cells. This mask has the following format: - <Type> corresponds to one of the following constants:
| | typInputCurrency | Currency type | typInputDate | Date type | typInputDuration | Duration type | typInputNum | Numeric type (integer, real, ...) | typInputText | Text type | typInputTime | Time 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
SpreadsheetTypeAndMaskSelection(<Spreadsheet control> , <Type> , <Mask>)
<Spreadsheet control>: Control name Name of the Spreadsheet control to be used. <Type>: Integer constant New type for the selected cell: | | typInputCurrency | Currency type | typInputDate | Date type | typInputDuration | Duration type | typInputNum | Numeric type (integer, real, ...) | typInputText | Text type | typInputTime | Time 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 have the ability to use the "DD/MM/YYYY" mask.
- on a numeric: you have the ability to use the "999 999" mask.
Remarks: - (typInputText, "") means "no mask".
- The mask defined by SpreadsheetTypeAndMaskSelection can be modified by InputMask.
Caution: only the mask can be modified, the type of cell 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:
SpreadsheetSelectPlus(PSHEET_NoName1, "A") SpreadsheetTypeAndMaskSelection(PSHEET_NoName1, typInputDate, "DD-MM-YY")
Miscellaneous - The modify operation is added into the list of operations to cancel: 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:
|
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, - ...
|
This page is also available for…
|
|
|
|