Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

TableConditionalStyle Interface

A style that can be applied to table elements which meet a certain condition.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v19.1.Core.dll


public interface TableConditionalStyle :


The TableConditionalStyle is like a TableStyle for certain table elements. An instance of the TableConditionalStyle object can be created using the TableConditionalStyleProperties.CreateConditionalStyle method that takes a ConditionalTableStyleFormattingTypes enumeration member as a parameter. This parameter specifies a table element to which a style can be applied. Conditional styles belong to a certain table style. You can access them via the TableStyle.ConditionalStyleProperties property using the ConditionalTableStyleFormattingTypes enumeration value as an index.

To apply conditional styles selectively, use the Table.TableLook property.

The following code creates a new table style which descends from the existing style, creates new conditional styles within that style using the TableConditionalStyleProperties.CreateConditionalStyle method and applies the style to a newly created table. Note that conditional styles are selectively applied using the Table.TableLook property.

document.LoadDocument("TableStyles.docx", DocumentFormat.OpenXml)

' Create a new style that is based on the 'Grid Table 5 Dark Accent 1' style defined in the loaded document.
Dim myNewStyle As TableStyle = document.TableStyles.CreateNew()
myNewStyle.Parent = document.TableStyles("Grid Table 5 Dark Accent 1")
' Create conditional styles (styles for table elements)
Dim myNewStyleForFirstRow As TableConditionalStyle = myNewStyle.ConditionalStyleProperties.CreateConditionalStyle(ConditionalTableStyleFormattingTypes.FirstRow)
myNewStyleForFirstRow.CellBackgroundColor = Color.PaleVioletRed
Dim myNewStyleForFirstColumn As TableConditionalStyle = myNewStyle.ConditionalStyleProperties.CreateConditionalStyle(ConditionalTableStyleFormattingTypes.FirstColumn)
myNewStyleForFirstColumn.CellBackgroundColor = Color.PaleVioletRed
Dim myNewStyleForOddColumns As TableConditionalStyle = myNewStyle.ConditionalStyleProperties.CreateConditionalStyle(ConditionalTableStyleFormattingTypes.OddColumnBanding)
myNewStyleForOddColumns.CellBackgroundColor = System.Windows.Forms.ControlPaint.Light(Color.PaleVioletRed)
Dim myNewStyleForEvenColumns As TableConditionalStyle = myNewStyle.ConditionalStyleProperties.CreateConditionalStyle(ConditionalTableStyleFormattingTypes.EvenColumnBanding)
myNewStyleForEvenColumns.CellBackgroundColor = System.Windows.Forms.ControlPaint.LightLight(Color.PaleVioletRed)
' Create a new table and apply a new style.
Dim table As Table = document.Tables.Create(document.Range.End, 4, 4, AutoFitBehaviorType.AutoFitToWindow)
table.Style = myNewStyle
' Specify which conditonal styles are in effect.
table.TableLook = TableLookTypes.ApplyFirstRow Or TableLookTypes.ApplyFirstColumn


The following code snippets (auto-collected from DevExpress Examples) contain references to the TableConditionalStyle interface.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also