Table.TableLook Property
Gets or sets the table style options that modify the table appearance.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v18.2.Core.dll
Declaration
Property Value
Type | Description |
---|---|
TableLookTypes | The TableLookTypes enumeration values which specify table style options that change the table appearance. |
Available values:
Name | Description |
---|---|
None | Specifies that row and column banding formatting is applied to the table, but special formatting is not applied to the first row, last row, first column and last column. |
ApplyFirstRow | Specifies that special formatting is applied to the first row of the table. |
ApplyLastRow | Specifies that special formatting is applied to the last row of the table. |
ApplyFirstColumn | Specifies that special formatting is applied to the first column of the table. |
ApplyLastColumn | Specifies that special formatting is applied to the last column of the table. |
DoNotApplyRowBanding | Specifies that row banding formatting is not applied to the table. |
DoNotApplyColumnBanding | Specifies that column banding formatting is not applied to the table. |
Remarks
Use the TableLook property to apply row or column banding formatting to the table, or special formatting to the first row, last row, first column or last column.
Example
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.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/winforms-richedit-document-api-e5219
document.LoadDocument("TableStyles.docx", DocumentFormat.OpenXml)
document.BeginUpdate()
' 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)
document.TableStyles.Add(myNewStyle)
' 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
document.EndUpdate()