

For more information, refer to the How to: Align Cell Content example.

To change the alignment attributes of a range of cells, call the CellRange.BeginUpdateFormatting method for this range, modify the Alignment property of the returned Formatting object, and call the CellRange.EndUpdateFormatting method to finalize the modification. To apply the alignment to an individual cell, use the Cell object’s Formatting.Alignment property. To programmatically align data, use the properties of the Alignment object. The Alignment tab of the Format Cells… dialog allows end-users to align and rotate cell content and specify text control options.Įnd-users can invoke the Format Cells dialog with the Alignment tab open by clicking the dialog box launcher located in the bottom-right corner of the Alignment group in the Home tab of the Ribbon UI. For an example, refer to the How to: Specify Number or Date Format for Cell Content topic. To apply a number format to a cell or cell range programmatically, assign the corresponding number format code to the Formatting.NumberFormat property of the cell or cell range object. By default, all worksheet cells in the SpreadsheetControl are formatted with the General number format.Įnd-users can invoke the Format Cells dialog with the Number tab open by clicking the dialog box launcher located in the bottom-right corner of the Number group in the Home tab of the Ribbon UI. The Number tab of the Format Cells… dialog allows end-users to apply a number format to display cell numbers as monetary values, percentage values, date values, etc. (For an example on how to create a Ribbon UI, refer to the Getting Started document.) Number Tab To do this, provide the Home Ribbon page for the SpreadsheetControl. You can also allow end-users to invoke the Format Cells… dialog via the Ribbon UI.

The dialog box includes six tabs: Number Alignment Font Border Fill and ProtectionĮnd-users can invoke this dialog by right-clicking a cell and selecting the Format Cells… item from the context menu. The Format Cells dialog allows end-users to format data in a worksheet (specify cell background, font color and style, change content alignment, apply cell borders, etc.).
