[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
   Defined Names
   Data Binding
  [Expand]Pivot Tables
  [Expand]Charts and Graphics
  [Expand]Mail Merge
   [Expand]Rows and Columns
   [Expand]Import and Export Data
   [Expand]Data Binding
   [Expand]Mail Merge
   [Expand]Formatting Cells
   [Expand]Conditional Formatting
   [Expand]Group Data
   [Expand]Filter Data
     How to: Create a Table
     How to: Perform Calculations in a Table
     How to: Apply a Table Style
     How to: Create, Modify And Delete Table Styles
   [Expand]Pivot Tables
 [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]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[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: Apply a Table Style

The example below demonstrates how to format a table by using one of the predefined table styles.

To format a table by applying a table style, assign the corresponding TableStyle object to the Table.Style property. Access the required table style object from the Workbook.TableStyles collection by the table style name. Built-in table styles can also be obtained by their ids (the BuiltInTableStyleId enumeration members).

A table style consists of the collection of table style elements (TableStyle.TableStyleElements). Each table style element (TableStyleElement) specifies the formatting for a particular element of a table. The TableStyleElementType enumerator lists supported table style element types. The Table object provides the following properties to optionally specify table elements to be formatted as defined by the corresponding elements of the applied table style.

This example demonstrates how to access a table style by its name and apply it to an existing table. The Table.ShowHeaders and Table.ShowTotals properties are set to true to show the header and total row of the table. The Table.ShowTableStyleRowStripes and Table.ShowTableStyleColumnStripes properties are used to apply the striped column formatting to the table.

The Table.ShowTableStyleFirstColumn property is also set to true to apply specific formatting to the first column of the table.

The image below shows the table appearance when the TableStyleMedium16 style is applied (the workbook is opened in Microsoft® Excel®).

Expanded See Also

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