Spread for ASP.NET 12 Product Documentation
Setting a Text Cell
Spread for ASP.NET 12 Product Documentation > Developer's Guide > Customizing with Cell Types > Working with Editable Cell Types > Setting a Text Cell

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 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

  1. Define the text cell type by creating an instance of the TextCellType class.
  2. Set properties for the text cell.
  3. 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

  1. In the work area, select the cell or cells for which you want to set the cell type.
  2. Select the Home menu.
  3. Select the SetCellType icon under the CellType section.
  4. Select the cell type and any other cell properties.
  5. Select OK to close the dialog.
  6. Click Apply and Exit to close the Spread Designer.
See Also