Skip to main content

Document.DefaultTableProperties Property

Provides access to the default properties for document tables.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation

Declaration

TablePropertiesBase DefaultTableProperties { get; }

Property Value

Type Description
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:

using DevExpress.XtraRichEdit.API.Native;
// ...
richEditControl1.Document.DefaultTableProperties.TableBorders.Left.LineColor = Color.Blue;
richEditControl1.Document.DefaultTableProperties.TableBorders.Left.LineStyle = TableBorderLineStyle.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:

TablePropertiesBase tb = 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:

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