# Allowing Cell Data to Overflow

Learn how to control cell overflow behavior in Spread.NET to optimize your data presentation and improve user experience.

## Content

You can determine how the contents of a cell or a group of cells overflow into adjoining cells. If you allow cell contents to overflow:

* Left-aligned text in a cell overflows to the adjacent right cell.
* Right-aligned text in a cell overflows to the adjacent left cell.
* Centered text in a cell overflows to both the left and right adjacent cells.

An example of each of these is shown in the following figure.

![Cell Overflow Examples](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/cell-overflow-all.png)

To set the overflow behavior, use the following members for the overall component ([FpSpread](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.html) class) or the child sheet ([SpreadView](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SpreadView.html) class):

* [AllowCellOverflow](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.AllowCellOverflow.html)
* [GetMaximumCellOverflowWidth](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.GetMaximumCellOverflowWidth.html)
* [SetMaximumCellOverflowWidth](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.SetMaximumCellOverflowWidth.html)
* [AllowEditOverflow](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.AllowEditOverflow.html)

You can specify the amount of content that will overflow into adjacent cells by specifying the number of pixels of overflow allowed using the [SetMaximumCellOverflowWidth](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.SetMaximumCellOverflowWidth.html) method.
For more information on cell contents alignment, refer to [Aligning Cell Contents](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-cell/spwin-celldata/spwin-cellalign).

## Using the Properties Window

1. At design time, in the **Properties** window, select the Spread component.
2. Select (in the **Behavior** category) the **AllowCellOverflow** property or the **AllowEditOverflow** property.
3. Select **True** from the drop-down list to allow cells to overflow, or select **False** to prohibit cells from overflowing.

## Using a Shortcut

1. Allow the contents of a set of cells to overflow by setting the [AllowCellOverflow](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.AllowCellOverflow.html) property.
2. Specify the maximum amount of content allowed to overflow by calling the [SetMaximumCellOverflowWidth](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.SetMaximumCellOverflowWidth.html) method to specify the number of pixels allowed to overflow.

**Example**
This example code sets the component to allow cells to overflow but only up to the maximum of 130 pixels.

```csharp
fpSpread1.AllowCellOverflow = true;
fpSpread1.SetMaximumCellOverflowWidth(130);
```

```vbnet
fpSpread1.AllowCellOverflow = True
fpSpread1.SetMaximumCellOverflowWidth(130)
```

## Using Code

1. Allow the contents of a set of cells to overflow by setting the [FpSpread](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.html) [AllowCellOverflow](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.AllowCellOverflow.html) property.
2. Specify the maximum amount of content allowed to overflow by calling the [SetMaximumCellOverflowWidth](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.SetMaximumCellOverflowWidth.html) method to specify the number of pixels allowed to overflow.

**Example**
This example code sets the child sheet to allow cells to overflow up to a maximum width of 130.

```csharp
FarPoint.Win.Spread.SpreadView sv = fpSpread1.GetRootWorkbook();
sv.AllowCellOverflow = true;
sv.SetMaximumCellOverflowWidth(130);
```

```vbnet
Dim sv As FarPoint.Win.Spread.SpreadView = fpSpread1.GetRootWorkbook
sv.AllowCellOverflow = True
sv.SetMaximumCellOverflowWidth(130)
```

## Using the Spread Designer

1. Select the Spread component (or select Spread from the pull-down menu).
2. In the property list for the component, in the **Behavior** category, select the **AllowCellOverflow** property or the **AllowEditOverflow** and select the value **True**.
3. From the **File** menu choose **Apply and Exit** to apply your changes to the component and exit Spread Designer.

## See Also

[Resizing the Data to Fit the Cell](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-cell/spwin-celldata/spwin-appearshrink)
[Aligning Cell Contents](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-cell/spwin-celldata/spwin-cellalign)
[Resizing a Cell to Fit the Data](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-cell/spwin-celldata/spwin-cellfitdata)