# Aligning Cell Contents

Learn how you can set the horizontal or vertical alignment for the contents of a cell or a group of cells using Spread for ASP.NET.

## Content

You can set the horizontal or vertical alignment for the contents of a cell or a group of cells.
![Cell Alignment](https://cdn.mescius.io/document-site-files/images/346c9178-0ed8-4fb9-908b-1565b22fb408/artwork/cellalign.png)

## Using the Properties Window

1. At design time, in the **Properties** window, select the FpSpread component.
2. Select the **Sheets** property.
3. Click the button to display the **SheetView Collection Editor**.
4. Select the **Cells** collection and then select **HorizontalAlign** or **VerticalAlign** under the **Misc.** section (select the cells or cells).
5. You can also select a cell or cells and select **HorizontalAlign** or **VerticalAlign** (**Selected Item** drop-down option).
6. Click **Apply** and **OK**.

## Using a Shortcut

Set the [HorizontalAlign](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.Cell.HorizontalAlign.html) and [VerticalAlign](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.Cell.VerticalAlign.html) properties for the [FpSpread](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.FpSpread.html) object’s [Cells](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.Cells.html) property.

## Example

This example code sets the horizontal alignment of the first cell (A1) to be right-aligned, the vertical alignment of that cell to be top-aligned, and the horizontal alignment of cells from B2 to C3 to be centered.

```csharp
FpSpread1.Sheets[0].Cells[0,0].HorizontalAlign = HorizontalAlign.Right;
FpSpread1.Sheets[0].Cells[0,0].VerticalAlign = VerticalAlign.Top;
FpSpread1.Sheets[0].Cells[1,1,2,2].HorizontalAlign = HorizontalAlign.Center;
```

```vbnet
FpSpread1.Sheets(0).Cells(0,0).HorizontalAlign = HorizontalAlign.Right
FpSpread1.Sheets(0).Cells(0,0).VerticalAlign = VerticalAlign.Top
FpSpread1.Sheets(0).Cells(1,1,2,2).HorizontalAlign = HorizontalAlign.Center
```

## Using the Spread Designer

1. Select the **Home** menu.
2. Select the cells you wish to change.
3. Select the appropriate icon in the **Alignment** section.
4. Click **Apply** to apply the changes.
5. From the **File** menu choose **Apply and Exit** to apply your changes to the component and exit Spread Designer.