How to: Apply a Predefined Style to a Pivot Table
The example below demonstrates how to change the appearance of the existing pivot table using one of the predefined pivot table styles. To apply a style, assign the corresponding TableStyle object to the PivotTable.Style property. Access the required pivot table style from the IWorkbook.TableStyles collection by its ID (a member of the BuiltInPivotStyleId enumeration).
Note that you can also create your own style and apply it to a pivot table, as shown in the How to: Apply a Custom Style to a Pivot Table example.
A complete sample project is available at https://github.com/DevExpress-Examples/wpf-spreadsheet-pivot-table-api-t314425.
Dim worksheet As Worksheet = workbook.Worksheets("Report1") workbook.Worksheets.ActiveWorksheet = worksheet ' Access the pivot table by its name in the collection. Dim pivotTable As PivotTable = worksheet.PivotTables("PivotTable1") ' Set the pivot table style. pivotTable.Style = workbook.TableStyles(BuiltInPivotStyleId.PivotStyleDark7)
The image below shows the pivot table appearance when the PivotStyleDark7 style is applied.