You can use currency cells to restrict users to entering currency values and to display data as currency values. The currency cell has a default error message that is displayed if the user types an invalid value and tries to leave the cell. This message can be changed using the properties for the currency cell class.
By default, Spread for ASP.NET uses the regional Windows settings (or options) for the formatting of currency. The CurrencyCellType class does not use the NumberFormatInfo property inherited from the GeneralCellType. The currency cell type always uses the System.Threading.Thread.CurrentThread.CurrentCulture. These settings are:
- currency symbol (and whether to display it)
- separator character (and whether to display it)
- decimal symbol
- whether to display a leading zero
- positive currency format
- negative currency format
For details on the properties and methods for this cell type, refer to the CurrencyCellType class.
See how to define the limits for values at Limiting Values for a Currency Cell.
Return to the overview of editable cell types at Working with Editable Cell Types.
Using Code
- Define a currency cell type by creating an instance of the CurrencyCellType class.
- Specify the formatting of a currency cell type.
- Assign the currency cell type to a cell.
Example
C# | Copy Code |
---|---|
FarPoint.Web.Spread.CurrencyCellType currcell = new FarPoint.Web.Spread.CurrencyCellType();
currcell.MinimumValue = 1;
FpSpread1.ActiveSheetView.Cells[1,1].CellType = currcell;
|
VB | Copy Code |
---|---|
Dim currcell As New FarPoint.Web.Spread.CurrencyCellType() currcell.MinimumValue = 1 FpSpread1.ActiveSheetView.Cells(1,1).CellType = currcell |
Using the Spread Designer
- In the work area, select the cell or cells for which you want to set the cell type.
- Select the Home menu.
- Select the SetCellType icon under the CellType section.
- Select the cell type and any other cell properties.
- Select OK to close the dialog.
- Click Apply and Exit to close the Spread Designer.