Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Collapse]Spreadsheet
   [Expand]Product Information
    Product Structure
    Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
   [Expand]Spreadsheet Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
    Data Grouping
   [Expand]Pivot Table Overview
   [Expand]Charting Overview
    Printing
    Events
   [Expand]Mail Merge Overview
    Protection
    Find and Replace
   [Collapse]Visual Elements
     Workbook
     Worksheet
    [Expand]Cells and Cell Ranges
     Rows and Columns
     Formulas
     Name Box
     Pictures
    [Collapse]Dialogs
      Format Cells Dialog
      Paste Special Dialog
      Edit Hyperlink Dialog
      Symbol Dialog
      Create Table Dialog
      Change Chart Type Dialog
      Find and Replace Dialog
      Encrypt Document Dialog
      Password Dialog
      Protect Workbook Dialog
      Protect Sheet Dialog
      User Permissions Dialog
      Insert Function Dialog
      Function Arguments Dialog
      Name Manager
      New Name Dialog
      Create Names from Selection Dialog
      Subtotal Dialog
      Data Validation Dialog
      Properties Dialog
      Page Setup Dialog
      Header and Footer Dialog
      Create PivotTable Dialog
      Move PivotTable Dialog
      PivotTable Field List
      PivotTable Field Settings Dialog
      PivotTable Value Field Settings Dialog
      PivotTable Sort Dialog
      Insert Calculated Field Dialog
      Insert Calculated Item Dialog
      PivotTable Options Dialog
      PivotTable Solve Order Dialog
      New Formatting Rule Dialog
      Conditional Formatting Rules Manager
    Services
   [Expand]Shortcuts
   [Expand]Examples
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Format Cells Dialog

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.). The dialog box includes six tabs: Number, Alignment, Font, Border, Fill and Protection.

End-users can invoke this dialog by right-clicking a cell and selecting the Format Cells... item from the context menu.

You can also allow end-users to invoke the Format Cells... dialog via the Ribbon UI. To do this, provide the Home Ribbon page for the SpreadsheetControl. (For an example on how to create a Ribbon UI, refer to the Getting Started document.)

Expanded Number Tab

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. By default, all worksheet cells in the SpreadsheetControl are formatted with the General number format.

End-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.

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. For an example, refer to the How to: Specify Number or Date Format for Cell Content topic.

Expanded Alignment Tab

The Alignment tab of the Format Cells... dialog allows end-users to align and rotate cell content and specify text control options.

End-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.

To programmatically align data, use the properties of the Alignment object.

To apply the alignment to an individual cell, use the Cell object's Formatting.Alignment property. To change the alignment attributes of a range of cells, call the Range.BeginUpdateFormatting method for this range, modify the Alignment property of the returned Formatting object, and call the Range.EndUpdateFormatting method to finalize the modification. For more information, refer to the How to: Align Cell Content example.

Expanded Font Tab

The Font tab of the Format Cells... dialog allows end-users to specify a typeface and its attributes (such as style, size, color, underlining and effects).

End-users can invoke the Format Cells dialog with the Font tab open by clicking the dialog box launcher located in the bottom-right corner of the Font group in the Home tab of the Ribbon UI.

You can also modify font attributes programmatically. To do this for an individual cell, modify the Formatting.Font property of the Cell object. To change the font characteristics for a range of cells, call the Range.BeginUpdateFormatting method for this range, modify the Font property of the returned Formatting object, and call the Range.EndUpdateFormatting method to finalize the modification. For an example, refer to the How to: Change Cell Font and Background Color document.

Expanded Border Tab

The Border tab of the Format Cells... dialog allows end-users to apply a border around an individual cell or a range of cells and customize border appearance by changing the line style and color.

To access and specify cell borders programmatically, use the Borders object. To access this object for an individual cell, use the Formatting.Borders property of the Cell object. To apply borders to a range of cells, call the Range.BeginUpdateFormatting method for this range, and specify the Borders property of the returned Formatting object. Then call the Range.EndUpdateFormatting method to finalize the modification. For more information, refer to the How to: Add and Remove Cell Borders document.

Expanded Fill Tab

The Fill tab of the Format Cells... dialog provides end-users with the capability to specify the cell background color and pattern style.

To specify the background color programmatically for an individual cell, modify the Formatting.Fill property of the Cell object. To change font characteristics for a range of cells, call the Range.BeginUpdateFormatting method for this range, modify the Fill property of the returned Formatting object, and call the Range.EndUpdateFormatting method to finalize the modification. For an example, refer to the How to: Change Cell Font and Background Color document.

The SpreadsheetControl also provides the capability to specify a gradient fill for a cell's background color. Use the Formatting.Fill property to access the Fill object that specifies the cell background fill. Set the Fill.FillType property to FillType.Gradient and specify the gradient characteristics. For details, refer to the How to: Apply Gradient Fill example.

Expanded Protection Tab

The Protection tab of the Format Cells... dialog offers end-users two options for worksheet protection: Locked and Hidden.

However, these options have no effect if the document is not protected. To protect a worksheet, on the Review tab, in the Changes group, click the Protect Sheet button. This invokes the Protect Sheet dialog, which allows end-users to protect worksheet elements with an optional password. You can also protect the document in code by using the Worksheet.Protect method. For more information on the document protection, refer to the Protection article.

When the Locked option is turned on and the worksheet is protected, end-users cannot edit or delete the cell content, enter new data, move cells or resize cells. This option is turned on by default.

When the Hidden option is turned on and the worksheet is protected, the cell content is not displayed in the formula bar, so end-users can only see the calculated results, but not the underlying formulas. Note that this option is turned off by default.

To programmatically specify which cells you wish to make locked or hidden, utilize the Formatting.Protection property. This property returns the Protection object, which contains cell protection options. Use the Protection.Locked and Protection.Hidden properties to lock cells and hide cell content.

How would you rate this topic?​​​​​​​