Spread Windows Forms 8.0 Product Documentation > Developer's Guide > Customizing Interaction with Cell Types > Working with Editable Cell Types > Setting a Text Cell |
You can create a text cell that allows only text to be displayed or treats the contents of a cell as only text.
You can also specify if the text shows up as all lower case, upper case, or normal with the CharacterCasing property. The CharacterSet property allows you to specify numbers only, letters only, numbers and letters, or any ASCII characters.
You use the TextCellType class to set the text cell and its properties.
This example creates a text cell with a maximum length.
C# |
Copy Code
|
---|---|
FarPoint.Win.Spread.CellType.TextCellType tcell = new FarPoint.Win.Spread.CellType.TextCellType(); tcell.CharacterCasing = CharacterCasing.Upper; tcell.CharacterSet = FarPoint.Win.Spread.CellType.CharacterSet.Ascii; tcell.MaxLength = 30; tcell.Multiline = true; fpSpread1.ActiveSheet.Cells[0, 0].Text = "This is a text cell."; fpSpread1.ActiveSheet.Cells[0, 0].CellType = tcell; |
VB |
Copy Code
|
---|---|
Dim tcell As New FarPoint.Win.Spread.CellType.TextCellType() tcell.CharacterCasing = CharacterCasing.Upper tcell.CharacterSet = FarPoint.Win.Spread.CellType.CharacterSet.Ascii tcell.MaxLength = 40 tcell.Multiline = True FpSpread1.ActiveSheet.Cells(0, 0).Text = "This is a text cell." FpSpread1.ActiveSheet.Cells(0, 0).CellType = tcell |
Or right-click on the cell or cells and select Cell Type. From the list, select Text. In the CellType editor, set the properties you need. Click Apply.