[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Collapse]Spreadsheet
    Product Structure
   [Expand]Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
   [Expand]Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
   [Expand]Pivot Table Overview
   [Expand]Charting Overview
    Shapes
    Printing
    Protection
    Find and Replace
   [Expand]Mail Merge
   [Expand]Visual Elements
    Services
    Themes and Templates
   [Expand]Shortcuts
   [Collapse]Examples
    [Expand]Files
    [Expand]Workbooks
    [Expand]Worksheet
    [Expand]Rows and Columns
    [Expand]Cells
    [Expand]Formulas
    [Expand]Data Binding
    [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: Specify Number or Date Format for Cell Content
      How to: Change Cell Font and Background Color
      How to: Apply Gradient Fill
      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]Charts
    [Expand]Protection
    [Expand]Mail Merge
    [Expand]Cell Templates
    [Expand]Commands
    [Expand]Customization
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Create or Modify a Style

Expanded Create Your Own Custom Style

  • Create a New Style

    Show Me

    A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4938.

    1. Add a new style to the Workbook.Styles collection by calling the StyleCollection.Add method with the style name passed as a parameter. This method returns the Style object corresponding to the created style. This object's Style.Name property is set to the specified name. Other settings are identical to the Normal built-in style.
    2. Use properties of the newly created Style object to set the required format characteristics.

    End-users can select an existing custom style from the collection of available styles, and use it to format cells.

  • Create a New Style Based on a Built-In Style

    Show Me

    A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4938.

    1. Add a new style to the Workbook.Styles collection by calling the StyleCollection.Add method with the style name passed as a parameter. This method returns the Style object corresponding to the created style. This object's Style.Name property is set to the specified name. Other settings are identical to the Normal built-in style.
    2. To copy all format settings from a Microsoft® Excel® built-in style to the newly created style, use the Style.CopyFrom method with the built-in style id (a member of the BuiltInStyleId enumeration) passed as a parameter.
    3. Use properties of the newly created Style object to change the required format settings of the style.

Expanded Modify an Existing Style

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4938.

  1. Access a style to be modified. To do this, get the corresponding Style object from the Workbook.Styles collection by the style name or index.
  2. Use the style's Formatting.BeginUpdate and Formatting.EndUpdate paired methods to modify the required format attributes of the style.

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