You can create a text cell that displays text and allows you to specify patterns of allowed characters. Text cells are useful if you want to restrict the type of data the user can type in the cell. The GcTextBox cell is part of the GrapeCity.Win.PluginInputMan assembly.
The GcTextBox cell allows you to specify automatic complete mode and a custom source with the AutoCompleteMode and AutoCompleteCustomSource properties.
You can set maximum limits for the cell with the MaxLength property.
You can use the ShortcutKeys property to map keys to actions for the GcTextBox cell. 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.
The GcTextBox cell has the following properties:
Name | Description |
AcceptsArrowKeys | Gets or sets how arrow keys are processed by the edit control. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase) |
AcceptsCrLf | Gets or sets a value that indicates how to process the CrLf characters when copying, cutting, or pasting a string. |
AcceptsTabChar | Gets or sets a value that indicates how to process the Tab characters when copying, cutting, or pasting the string. |
AllowSpace | Gets or sets the allow space settings. |
AlternateText | Gets the alternate text of the GcTextBox control. |
AutoComplete | Gets the automatic complete related settings. |
AutoCompleteCustomSource | Gets or sets a custom System.Windows.Forms.AutoCompleteStringCollection to use when the GcTextBox.AutoCompleteSource property is set to CustomSource. |
AutoCompleteMode | Gets or sets an option that controls how automatic completion works for the GcTextBox control. |
AutoCompleteSource | Gets or sets a value that specifies the source of strings used for automatic completion. |
AutoConvert | Gets or sets whether to automatically convert the entered characters according to the input mask. |
BackgroundImage | Gets or sets the background image for the cell. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase) |
DisplayAlignment | Gets or sets the text alignment when displaying the horizontal axis when the control does not have input focus. |
DropDown | Gets the drop-down settings used to customize the drop-down function. |
DropDownEditor | Gets the settings for the drop-down editor. |
EditMode | Gets or sets the edit mode of the control. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase) |
Ellipsis | Gets or sets a value that indicates how the ellipsis character (…) appears, denoting that the GcTextBox text extends beyond the specified length of the GcTextBox cell. |
EllipsisString | Gets or sets what is shown as an ellipsis when the text width is longer than the control. |
ExcelExportFormat | Gets or sets the format string used by Excel when exporting to an Excel file. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase) |
ExitOnLastChar | Gets or sets whether the next control in the tab order receives the focus as soon as the control is filled with the last character. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase) |
FocusPosition | Gets or sets the initial cursor position when the editor gets focus. |
FormatString | Gets or sets the input format to use in the control. |
GridLine | Gets or sets a Line that indicates the grid line style for each line. |
LineSpace | Gets or sets the line space between two adjacent lines. |
MaxLength | Gets or sets the maximum number of characters or bytes that the control can hold. |
MaxLengthCodePage | Gets or sets the code page for the encoding that is used to count the maximum length in bytes. |
MaxLengthUnit | Gets or sets whether the maximum number of characters allowed in the control is handled based on bytes, characters, or text elements. |
MaxLineCount | Gets or sets the maximum number of acceptable lines. |
Multiline | Gets or sets whether the control can accept and display multiple lines of text. |
PasswordChar | Gets or sets the character used as a placeholder for the characters typed by the user. |
PasswordRevelationMode | Gets or sets the password revelation mode. |
ReadOnly | Gets or sets a value that indicates whether this control is read-only. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase) |
RecommendedValue | Gets or sets the recommended value. |
ScrollBarMode | Gets or sets how to display the scroll bars. |
ScrollBars | Gets or sets which scroll bars appear in a multiline GcTextBox control. |
ShortcutKeys | Gets the InputMan EditingControl’s shortcuts. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase) |
ShowRecommendedValue | Gets or sets a value that indicates whether to show the recommended value. |
ShowTouchToolBar | Gets or sets the how to show the InputManCellTypeBase.TouchToolBar. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase) |
SideButtons | Gets the side buttons of this GcTextBox control. |
Static | Gets or sets whether the cell is static, which prohibits user interaction. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase) |
SubEditor | Gets or sets the subeditor. (Inherited from FarPoint.Win.Spread.CellType.BaseCellType) |
TouchContextMenuScale | Gets or sets whether the factor applies to the context menu item’s height while the context menu is open due to a touch action. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase) |
TouchToolBar | Gets the shown InputManCellTypeBase.TouchToolBar by touch operation. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase) |
UseSpreadDropDownButtonRender | Gets or sets a value that indicates whether to paint the drop-down button with the spread drop-down button renderer. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase) |
UseSystemPasswordChar | Gets or sets a value that indicates whether to use system password characters. |
WrapMode | Gets or sets the wrap rule when the GcTextBox control is multiline. |
This example uses the ShortcutKeys property. Use Alt + Enter to add a new line while the cell is in edit mode. The following image displays the list of actions that you can use.
C#
// Select Alt + Enter to go to the next line
GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType gcText = new GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType();
gcText.Multiline = true;
gcText.ShortcutKeys.Add(Keys.Enter | Keys.Alt, "InputNewLine");
fpSpread1.Sheets[0].Cells[0, 0].CellType = gcText;
VB
'Select Alt + Enter to go to the next line
Dim gcText As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
gcText.Multiline = True
gcText.ShortcutKeys.Add(Keys.Enter Or Keys.Alt, "InputNewLine")
FpSpread1.Sheets(0).Cells(0, 0).CellType = gcText
This example sets the maximum number of characters that can be typed in the cell.
C#
GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType inputcell1 = new GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType();
inputcell1.MaxLengthUnit = GrapeCity.Win.Spread.InputMan.CellType.LengthUnit.Char;
inputcell1.MaxLength = 10;
fpSpread1.Sheets[0].Cells[1, 1].CellType = inputcell1;
VB
Dim inputcell1 As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType
inputcell1.MaxLengthUnit = GrapeCity.Win.Spread.InputMan.CellType.LengthUnit.Char
inputcell1.MaxLength = 10
FpSpread1.Sheets(0).Cells(1, 1).CellType = inputcell1
This example creates a GcTextBox cell and cuts CrLf characters in copied, cut, or pasted strings.
C#
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
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
This example uses password characters in place of the typed content.
C#
GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType gctext = new GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType();
gctext.PasswordChar = Convert.ToChar("A");
fpSpread1.Sheets[0].Cells[1, 1].CellType = gctext;
VB
Dim gctext As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
gctext.PasswordChar = Chr(65)
FpSpread1.Sheets(0).Cells(1, 1).CellType = gctext
This example allows you to type symbols.
C#
GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType inputcell = new GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType();
//Symbols
inputcell.FormatString = "@";
fpSpread1.Sheets[0].Cells[0, 0].CellType = inputcell;
VB
Dim inputcell As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
'Symbols
inputcell.FormatString = "@"
FpSpread1.Sheets(0).Cells(0, 0).CellType = inputcell