Back to Devexpress

Document.DefaultTableProperties Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-document-043a41bf.md

latest3.8 KB
Original Source

Document.DefaultTableProperties Property

Provides access to the default properties for document tables.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
TablePropertiesBase DefaultTableProperties { get; }
vb
ReadOnly Property DefaultTableProperties As TablePropertiesBase

Property Value

TypeDescription
TablePropertiesBase

A TablePropertiesBase interface specifying table properties.

|

Remarks

The table and cells formatting settings are applied in the following order:

  • Cell settings
  • The “Table Simple 1” table style settings
  • The DefaultTableProperties property settings

The built-in “Table Simple 1” style defines all major appearance settings for the table. Hence, the DefaultTableProperties property settings usually are not applied because the corresponding characteristics of the “Table Simple 1” style are not empty.

Consider the following code:

csharp
using DevExpress.XtraRichEdit.API.Native;
// ...
richEditControl1.Document.DefaultTableProperties.TableBorders.Left.LineColor = Color.Blue;
richEditControl1.Document.DefaultTableProperties.TableBorders.Left.LineStyle = BorderLineStyle.Single;
richEditControl1.Document.DefaultTableProperties.TableBorders.Left.LineThickness = 1;
vb
Imports DevExpress.XtraRichEdit.API.Native
' ...
richEditControl1.Document.DefaultTableProperties.TableBorders.Left.LineColor = Color.Blue
richEditControl1.Document.DefaultTableProperties.TableBorders.Left.LineStyle = BorderLineStyle.Single
richEditControl1.Document.DefaultTableProperties.TableBorders.Left.LineThickness = 1

The left border of the document tables however, remains black and not blue, because it is defined in the default “Table Simple 1” style.

To change the border color, modify the style as illustrated below:

csharp
TablePropertiesBase tb = richEditControl1.Document.TableStyles["Table Simple 1"];
tb.TableBorders.Left.LineColor = Color.Red;
vb
Dim tb As TablePropertiesBase = richEditControl1.Document.TableStyles("Table Simple 1")
tb.TableBorders.Left.LineColor = Color.Red

Now the “Table Simple 1” style specifies that the left border is red. To apply settings specified earlier by the DefaultTableProperties property, it is necessary to define a new “Table Simple 1” style or delete it:

csharp
richEditControl1.Document.TableStyles.Delete(richEditControl1.Document.TableStyles["Table Simple 1"]);
vb
richEditControl1.Document.TableStyles.Delete(richEditControl1.Document.TableStyles("Table Simple 1"))

After removing the default style, all tables with that style will use the settings specified by the DefaultTableProperties property. So the blue left border is the only visible border of the table.

See Also

Document Interface

Document Members

DevExpress.XtraRichEdit.API.Native Namespace