A newer version of this page is available. Switch to the current version.

Document.TableStyles Property

Provides access to a collection of styles defined for tables in the document.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v18.2.Core.dll

Declaration

TableStyleCollection TableStyles { get; }

Property Value

Type Description
TableStyleCollection

A TableStyleCollection object containing table styles.

Examples

The following code creates a new table style from scratch, creates a table and applies a new style to a newly created table.

document.BeginUpdate()
' Create a new table style.
Dim tStyleMain As TableStyle = document.TableStyles.CreateNew()
' Specify style characteristics.
tStyleMain.AllCaps = True
tStyleMain.FontName = "Segoe Condensed"
tStyleMain.FontSize = 14
tStyleMain.Alignment = ParagraphAlignment.Center
tStyleMain.TableBorders.InsideHorizontalBorder.LineStyle = TableBorderLineStyle.Dotted
tStyleMain.TableBorders.InsideVerticalBorder.LineStyle = TableBorderLineStyle.Dotted
tStyleMain.TableBorders.Top.LineThickness = 1.5F
tStyleMain.TableBorders.Top.LineStyle = TableBorderLineStyle.Double
tStyleMain.TableBorders.Left.LineThickness = 1.5F
tStyleMain.TableBorders.Left.LineStyle = TableBorderLineStyle.Double
tStyleMain.TableBorders.Bottom.LineThickness = 1.5F
tStyleMain.TableBorders.Bottom.LineStyle = TableBorderLineStyle.Double
tStyleMain.TableBorders.Right.LineThickness = 1.5F
tStyleMain.TableBorders.Right.LineStyle = TableBorderLineStyle.Double
tStyleMain.CellBackgroundColor = System.Drawing.Color.LightBlue
tStyleMain.TableLayout = TableLayoutType.Fixed
tStyleMain.Name = "MyTableStyle"
'Add the style to the document.
document.TableStyles.Add(tStyleMain)
document.EndUpdate()
document.BeginUpdate()
' Create a table.
Dim table As Table = document.Tables.Create(document.Range.Start, 3, 3)
table.TableLayout = TableLayoutType.Fixed
table.PreferredWidthType = WidthType.Fixed
table.PreferredWidth = DevExpress.Office.Utils.Units.InchesToDocumentsF(4.5F)
table(1, 1).PreferredWidthType = WidthType.Fixed
table(1, 1).PreferredWidth = DevExpress.Office.Utils.Units.InchesToDocumentsF(1.5F)
' Apply a previously defined style.
table.Style = tStyleMain
document.EndUpdate()

document.InsertText(table(1, 1).Range.Start, "STYLED")
See Also