# Text Cell

Learn how to create and customize text cells for your spreadsheet with Spread for WPF.

## Content

Text cells display only text or treat the contents of a cell as text.
To configure the text cell type in a worksheet, use the methods and properties of the **TextCellType** class in the **GrapeCity.Wpf.SpreadSheet.CellType** namespace.
The text cell type can restrict the type of characters that a user can input. This can be achieved by setting a keyword in the **Format** property of the **TextCellType** class to indicate the allowed character types.
The following example code sets the Format property of a text cell and restricts the input of surrogate pair characters.
**C#**

```csharp
// Set TextCellType.
TextCellType tc = new TextCellType();
tc.Format = "^T";
spreadSheet1.Workbook.ActiveSheet.Columns[0].CellType = tc;
```

**VB**

```auto
' Set TextCellType.
Dim tc As TextCellType = New TextCellType()
tc.Format = "^T"
spreadSheet1.Workbook.ActiveSheet.Columns(0).CellType = tc
```

Some of the main features of a text cell are explained below.

## Character Limits

You can set the maximum length of the input by using the **MaxLength** property. Additionally, the character counting method can be specified through the **MaxLengthUnit** property.

## Watermark

You can display placeholder text in empty cells using various watermark properties. Set the text shown when the cell is in input mode using **WatermarkNull**, whereas **WatermarkDisplayNull** lets you set the text displayed when the cell is not being edited. You can also set the color of each text using the **WatermarkNullForeground** and **WatermarkDisplayNullForeground** properties.

## Wrap Text

To automatically wrap text to the next line when it reaches the edge of a cell, set the **TextWrapping** property. Note that for this feature to function, the **MultiLine** property must be set to True.

## Line Breaks

To allow users to control line breaks, use the **AcceptsReturn** property. Note that this property only manages user input and does not affect the display.
Additionally, text cells provide the **Multiline** property to control the input and display of multiple lines of text. To enable users to enter line breaks, both the **Multiline** and **AcceptsReturn** properties must be set to True. In this case, users can use **Alt+Enter** to insert a line break.

## Multi-line Text

Text cells provide the **Multiline** property to manage the input and display of multiple lines of text. If the Multiline property is set to False, the input and display of multiple lines are disabled.
If you want to restrict users to only input line breaks and enable the display of multiple lines with automatic text wrapping, set the Multiline property to True and the AcceptsReturn property to False.