Back to Devexpress

Table.TableBackgroundColor Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-table-1be5eb01.md

latest6.2 KB
Original Source

Table.TableBackgroundColor Property

Gets or sets the color of an empty space between cells.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
Color TableBackgroundColor { get; set; }
vb
Property TableBackgroundColor As Color

Property Value

TypeDescription
Color

A Color that is the color of the background.

|

Remarks

By default, there is no empty space between cells. To specify a distance between cells, use the Table.TableCellSpacing property. The TableBackgroundColor is applied to an area around the cells with the width equal to double the Table.TableCellSpacing property value.

To change the cell background, use the TableCell.BackgroundColor property.

Important

The semi-transparent alpha component (i.e. the Color’s alpha parameter set to value less than 255) is reset to opaque (255) during export to all formats except PDF.

Example

View Example

csharp
Document document = server.Document;
// Create a table.
Table table = document.Tables.Create(document.Range.Start, 3, 5, AutoFitBehaviorType.AutoFitToWindow);
table.BeginUpdate();
// Provide the space between table cells.
// The distance between cells will be 4 mm.
document.Unit = DevExpress.Office.DocumentUnit.Millimeter;
table.TableCellSpacing = 2;
// Change the color of empty space between cells.
table.TableBackgroundColor = Color.Violet;
//Change cell background color.
table.ForEachCell(new TableCellProcessorDelegate(TableHelper.ChangeCellColor));
table.ForEachCell(new TableCellProcessorDelegate(TableHelper.ChangeCellBorderColor));
table.EndUpdate();
vb
Dim document As Document = server.Document
' Create a table.
Dim table As Table = document.Tables.Create(document.Range.Start, 3, 5, AutoFitBehaviorType.AutoFitToWindow)
table.BeginUpdate()
' Provide the space between table cells.
' The distance between cells will be 4 mm.
document.Unit = DevExpress.Office.DocumentUnit.Millimeter
table.TableCellSpacing = 2
' Change the color of empty space between cells.
table.TableBackgroundColor = Color.Violet
'Change cell background color.
table.ForEachCell(New TableCellProcessorDelegate(AddressOf TableHelper.ChangeCellColor))
table.ForEachCell(New TableCellProcessorDelegate(AddressOf TableHelper.ChangeCellBorderColor))
table.EndUpdate()

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

Note

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.

winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Table.cs#L78

csharp
// Change the color of empty space between cells.
table.TableBackgroundColor = Color.Violet;
//Change cell background color.

wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/TableActions.cs#L179

csharp
// Change the color of empty space between cells.
table.TableBackgroundColor = Color.Violet;
//Change cell background color.

word-document-api-examples/CS/CodeExamples/TablesActions.cs#L125

csharp
// Change the color of the space between cells.
table.TableBackgroundColor = Color.Violet;

winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Table.vb#L68

vb
' Change the color of empty space between cells.
table.TableBackgroundColor = System.Drawing.Color.Violet
'Change cell background color.

wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/TableActions.vb#L160

vb
' Change the color of empty space between cells.
table.TableBackgroundColor = Color.Violet
'Change cell background color.

word-document-api-examples/VB/CodeExamples/TablesActions.vb#L115

vb
' Change the color of the space between cells.
table.TableBackgroundColor = Color.Violet

See Also

Table Interface

Table Members

DevExpress.XtraRichEdit.API.Native Namespace