You can use a percent cell to display percent values. In a percent cell type, a value of 0.35 is displayed as 35%. You can use a percent cell for displaying values as percentages and restricting inputs to percentage numeric values.
The percent cell has a default error message that is displayed if the user types an invalid value and tries to leave the cell.
For details on the properties and methods for this cell type, refer to the PercentCellType class.
Using Code
- Define the percent cell type by creating an instance of the PercentCellType class.
- Assign the percent cell type to a cell.
Example
This example sets a cell to be an percent cell.
C# | Copy Code |
---|---|
FarPoint.Web.Spread.PercentCellType pctcell = new FarPoint.Web.Spread.PercentCellType();
FpSpread1.ActiveSheetView.Cells[1, 1].CellType = pctcell;
|
VB | Copy Code |
---|---|
Dim pctcell As New FarPoint.Web.Spread.PercentCellType() FpSpread1.ActiveSheetView.Cells(1, 1).CellType = pctcell |
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.