The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+
Row

Alignment.Vertical Property

Gets or sets the vertical alignment of the cell content.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v19.2.Core.dll

Declaration

SpreadsheetVerticalAlignment Vertical { get; set; }
Property Vertical As SpreadsheetVerticalAlignment
SpreadsheetVerticalAlignment Vertical { get; set; }
Property Vertical As SpreadsheetVerticalAlignment
SpreadsheetVerticalAlignment Vertical { get; set; }
Property Vertical As SpreadsheetVerticalAlignment

Property Value

Type Description
SpreadsheetVerticalAlignment

A SpreadsheetVerticalAlignment enumeration member specifying how cell data should be vertically aligned.

Property Value

Type Description
SpreadsheetVerticalAlignment

A SpreadsheetVerticalAlignment enumeration member specifying how cell data should be vertically aligned.

Property Value

Type Description
SpreadsheetVerticalAlignment

A SpreadsheetVerticalAlignment enumeration member specifying how cell data should be vertically aligned.

Remarks

Use the Vertical and Alignment.Horizontal properties to specify the vertical and horizontal alignment of cell data.

To set other alignment characteristics for a cell or range of cells (e.g., indent, text rotation, values indicating whether the text should be wrapped and shrunk in a cell), use the corresponding properties of the Alignment object. Access this object via the Formatting.Alignment property.

For examples on how to specify formatting for an individual cell and cell range or modify a style, refer to the How to: Format a Cell or Range of Cells or How to: Create or Modify a Style document, respectively.

Examples

This example demonstrates how to specify the alignment of cell content by modifying the Alignment object accessed via the Formatting.Alignment property of the Cell object.

Cell cellA1 = worksheet.Cells["A1"];
cellA1.Value = "Right and top";
cellA1.Alignment.Horizontal = SpreadsheetHorizontalAlignment.Right;
cellA1.Alignment.Vertical = SpreadsheetVerticalAlignment.Top;

Cell cellA2 = worksheet.Cells["A2"];
cellA2.Value = "Center";
cellA2.Alignment.Horizontal = SpreadsheetHorizontalAlignment.Center;
cellA2.Alignment.Vertical = SpreadsheetVerticalAlignment.Center;

Cell cellA3 = worksheet.Cells["A3"];
cellA3.Value = "Left and bottom, indent";
cellA3.Alignment.Indent = 1;

Cell cellB1 = worksheet.Cells["B1"];
cellB1.Value = "The Alignment.ShrinkToFit property is applied";
cellB1.Alignment.ShrinkToFit = true;

Cell cellB2 = worksheet.Cells["B2"];
cellB2.Value = "Rotated Cell Contents";
cellB2.Alignment.Horizontal = SpreadsheetHorizontalAlignment.Center;
cellB2.Alignment.Vertical = SpreadsheetVerticalAlignment.Center;
cellB2.Alignment.RotationAngle = 15;

Cell cellB3 = worksheet.Cells["B3"];
cellB3.Value = "The Alignment.WrapText property is applied to wrap the text within a cell";
cellB3.Alignment.WrapText = true;
See Also