Spread Windows Forms 8.0 Product Documentation
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.

Using the Properties Window

  1. At design time, in the Properties window, select the Spread component.
  2. Select the Sheets property.
  3. Click the button to display the SheetView Collection Editor.
  4. In the Members list, select the sheet in which the cells appear.
  5. In the property list, select the Cells property and then click the button to display the Cell, Column, and Row Editor.
  6. Select the cells for which you want to set the cell type.
  7. In the property list, select the CellType property and choose the Text cell type.
  8. Expand the list of properties under the CellType property. Select and set these specific properties as needed.
  9. Click OK to close the Cell, Column, and Row Editor.
  10. Click OK to close the SheetView Collection Editor.

Using Code

  1. Define the text cell by creating an instance of the TextCellType class.
  2. Set properties for the class.
  3. Assign the text cell type to a cell or range of cells by setting the CellType property for a cell, column, row, or style to the TextCellType object.

Example

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

Using the Spread Designer

  1. Select the cell or cells in the work area.
  2. In the property list, in the Misc category, select CellType. From the drop-down list, choose the Text cell type. Now expand the CellType property and various properties are available that are specific to this cell type. Select and set those properties as needed.

    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.

  3. From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback