Spread Windows Forms 13.0 Product Documentation
Spread Windows Forms 13.0 Product Documentation / Developer's Guide / Customizing Interaction with Cell Types / Working with Editable Cell Types / Setting a GcTextBox Cell
In This Topic
    Setting a GcTextBox Cell
    In This Topic

    You can create a text cell that displays text and allows you to specify patterns of allowed characters. The GcTextBoxCellType cell is part of the GrapeCity.Win.PluginInputMan assembly.

    You can specify an automatic complete mode and a custom source with the AutoCompleteMode and AutoCompleteCustomSource properties. You can also specify maximum limits for the cell with the MaxLength property.

    You can use the ShortcutKeys property to map keys to actions for the GcDateTime and GcTextBox cells. In edit mode, these shortcut keys have precedence over the Spread input maps. The cell uses the Spread input maps when not in edit mode.

    The FormatString property allows you to specify specific characters that are allowed in the cell. The following Spread Designer table displays the available characters.

    For a complete list of properties, see the GcTextBoxCellType class.

    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 GcTextBox 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 GcTextBoxCellType class.
    2. Set properties for the class.
    3. Assign the cell type to a cell or range of cells by setting the CellType property for a cell, column, row, or style to the GcTextBoxCellType object.

    Example

    This example creates a GcTextBox cell and cuts CrLf characters in copied, cut, or pasted strings.

    C#
    Copy Code
    GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType inputcell1 = new GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType();
    inputcell1.Multiline = true;
    inputcell1.AcceptsCrLf = GrapeCity.Win.Spread.InputMan.CellType.CrLfMode.Cut;
    fpSpread1.Sheets[0].Cells[1, 1].CellType = inputcell1;
    VB
    Copy Code
    Dim inputcell1 As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType
    inputcell1.Multiline = True
    inputcell1.AcceptsCrLf = GrapeCity.Win.Spread.InputMan.CellType.CrLfMode.Cut
    fpSpread1.Sheets(0).Cells(1, 1).CellType = inputcell1

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