[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Collapse]Office File API
  Demo Application
  Redistribution and Deployment
 [Collapse]Spreadsheet Document API
   Product Structure
   Getting Started
  [Expand]Spreadsheet Document
   Supported Formats
  [Expand]Cell Basics
  [Expand]Formulas
   Defined Names
   Data Binding
  [Expand]Pivot Tables
  [Expand]Charts and Graphics
  [Expand]Mail Merge
  [Collapse]Examples
   [Expand]Files
   [Expand]Workbooks
   [Expand]Worksheets
   [Expand]Rows and Columns
   [Expand]Cells
   [Expand]Formulas
   [Expand]Import and Export Data
   [Expand]Data Binding
    Sorting
   [Expand]Mail Merge
    Search
   [Expand]Shapes
   [Expand]Charts
   [Expand]Sparklines
   [Collapse]Formatting Cells
     How to: Apply a Style to a Cell or Range of Cells
     How to: Create or Modify a Style
     How to: Format a Cell or Range of Cells
     How to: Apply Rich Formatting to Cell Text
     How to: Specify Number or Date Format for Cell Content
     How to: Change Cell Font and Background Color
     How to: Configure Cell Font Settings
     How to: Align Cell Content
     How to: Add and Remove Cell Borders
     How to: Clear Cell Formatting
   [Expand]Conditional Formatting
   [Expand]Group Data
   [Expand]Filter Data
   [Expand]Tables
   [Expand]Pivot Tables
   [Expand]Printing
   [Expand]Pictures
   [Expand]Protection
 [Expand]Word Processing Document API
 [Expand]PDF Document API
 [Expand]Excel Export Library
 [Expand]Snap Report API
 [Expand]Zip Compression and Archive API
 [Expand]Barcode Generation API
 [Expand]Unit Conversion API
 [Expand]API Reference
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Align Cell Content

To align data contained within a cell, use the properties of the Alignment object.

To access this object to modify the alignment of individual cell content, use the Cell object's Formatting.Alignment property, which is inherited from the Formatting interface.

To change the alignment attributes for a range of cells, call the Range.BeginUpdateFormatting method for this range, use the Alignment property of the returned Formatting object to access and modify the Alignment object, and call the Range.EndUpdateFormatting method to finalize the modification.

The Alignment object provides the following properties to change cell alignment settings:

To share alignment settings with multiple cells in a single step, create or modify the style with the Formatting.Alignment property specified as required, and assign this style to Range.Style for the desired cells.

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.

The image below shows how text can be aligned within worksheet cells (the workbook is opened in Microsoft® Excel®).

Is this topic helpful?​​​​​​​