# Selection.CharacterSpacing Property

> Gets or sets a character spacing value, in twips, of the selected text. This value is added to each character. When it is negative, character spacing is reduced, otherwise it is extended.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 30.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.Core.SDK` (assembly `TXTextControl.Core.dll`, from the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.TextControl.ASP.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET Server > Reference > TXTextControl > Selection.CharacterSpacing Property
- **562 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/selection/characterspacing-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/selection/characterspacing-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/selection/characterspacing-property/llms-full.txt

---

### Description

Gets or sets a character spacing value, in twips, of the selected text. This value is added to each character. When it is negative, character spacing is reduced, otherwise it is extended.

### Syntax

```csharp
public int CharacterSpacing { get; set; }
```

```vbnet
Public Property CharacterSpacing As Integer
```

### Examples

The following example formats the heading of a short document by using `Selection.CharacterSpacing`.

```csharp
textControl.Text = "Quarterly results\nRevenue increased by 12%.";
textControl.Select(0, 17);
Selection selection = textControl.Selection;

selection.CharacterSpacing = 720;
Console.WriteLine($"Character Spacing used by Selection: {selection.CharacterSpacing}");
```

```vbnet
textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."
textControl.Select(0, 17)
Dim selection As Selection = textControl.Selection

selection.CharacterSpacing = 720
Console.WriteLine($"Character Spacing used by Selection: {selection.CharacterSpacing}")
```

### Remarks

The property's default value is 0.

The property returns its default value when the text selection contains multiple characters with mixed character spacing settings. The [Selection.IsCommonValueSelected](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/selection/iscommonvalueselected-method/llms-full.txt) method can be used to check for mixed attributes.

---

## Nearby

- **Previous:** [Selection.CharacterScaling Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/selection/characterscaling-property/llms-full.txt)
- **Next:** [Selection Constructor](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/selection/constructor/llms-full.txt)
