# ParagraphFormat.Alignment Property

> Gets or sets the horizontal text alignment.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Property
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WPF.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 for WPF > Reference > TXTextControl > ParagraphFormat.Alignment Property
- **719 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraphformat/alignment-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraphformat/alignment-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraphformat/alignment-property/llms-full.txt

---

### Description

Gets or sets the horizontal text alignment.

### Syntax

```csharp
public HorizontalAlignment Alignment { get; set; }
```

```vbnet
Public Property Alignment As HorizontalAlignment
```

### Members

| Value | Description |
|---|---|
| Left | Text is left aligned. |
| Right | Text is right aligned. |
| Center | Text is centered. |
| Justify | Text is justified. |

### Examples

The following example applies paragraph layout to selected report text by using `ParagraphFormat.Alignment`.

```csharp
textControl.Text = "First item\nSecond item\nThird item";
textControl.Select(0, textControl.Text.Length);
ParagraphFormat paragraphFormat = textControl.Selection.ParagraphFormat;

paragraphFormat.Alignment = TXTextControl.HorizontalAlignment.Center;
Console.WriteLine($"Alignment used by Paragraph Format: {paragraphFormat.Alignment}");

textControl.Selection.ParagraphFormat = paragraphFormat;
```

```vbnet
textControl.Text = "First item" & vbCrLf & "Second item" & vbCrLf & "Third item"
textControl.Select(0, textControl.Text.Length)
Dim paragraphFormat As ParagraphFormat = textControl.Selection.ParagraphFormat

paragraphFormat.Alignment = TXTextControl.HorizontalAlignment.Center
Console.WriteLine($"Alignment used by Paragraph Format: {paragraphFormat.Alignment}")

textControl.Selection.ParagraphFormat = paragraphFormat
```

### Remarks

The property's default value is HorizontalAlignment.Left.

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

---

## Nearby

- **Previous:** [ParagraphFormat.AbsoluteLineSpacing Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraphformat/absolutelinespacing-property/llms-full.txt)
- **Next:** [ParagraphFormat.Attribute Enumeration](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/paragraphformat/attribute-enumeration/llms-full.txt)
