You can use text cells to restrict users to entering text values and to display data as text. You can also specify the maximum text length and a password field.
The following image displays a text cell with a password.
For details on the properties and methods for this cell type, refer to the TextCellType class.
For information about checking a regular expression in a cell, refer to Setting a Regular Expression Cell.
If you anticipate that users need to display text with multiple blank spaces between consecutive words, you should set the FpSpread AllowWrap property to false; otherwise, the control uses spaces for formatting that Internet Explorer will trim as extra blank spaces (Internet Explorer allows one space in a TD element). If you set the AllowWrap property to false, the control uses the web space character for spaces, and the spaces are not trimmed in the text. |
Using Code
- Define the text cell type by creating an instance of the TextCellType class.
- Set properties for the text cell.
- Apply the text cell type to a cell or range of cells.
Example
This example sets a password and a maximum length for the cell.
C# | Copy Code |
---|---|
FarPoint.Web.Spread.TextCellType tcell = new FarPoint.Web.Spread.TextCellType(); tcell.Password = true; tcell.MaxLength = 5; FpSpread1.ActiveSheetView.Cells[0, 0].CellType = tcell; |
VB | Copy Code |
---|---|
Dim tcell As New FarPoint.Web.Spread.TextCellType() tcell.Password = True tcell.MaxLength = 5 FpSpread1.ActiveSheetView.Cells(0, 0).CellType = tcell |
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.