Back to Devexpress

Table.TableAlignment Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-table-1203ffdc.md

latest5.7 KB
Original Source

Table.TableAlignment Property

Gets or sets the alignment of a table as a whole within the document.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
TableRowAlignment TableAlignment { get; set; }
vb
Property TableAlignment As TableRowAlignment

Property Value

TypeDescription
TableRowAlignment

A TableRowAlignment enumeration value that specifies how the table is aligned in a document.

|

Available values:

NameDescription
Both

Justified.

| | Center |

Align center.

| | Distribute |

Distribute all characters equally.

| | Left |

Align left.

| | NumTab |

Align to the list tab.

| | Right |

Align right.

|

Remarks

The TableAlignment property is ignored if the Table.TextWrappingType property is set to TableTextWrappingType.Around.

The TableAlignment property does not affect the table row alignment. To change the row alignment, iterate through rows and set the TableRow.TableRowAlignment property as required.

csharp
foreach(TableRow row in tab.Rows)
    row.TableRowAlignment = TableRowAlignment.Right;
vb
For Each row As TableRow In tab.Rows
  row.TableRowAlignment = TableRowAlignment.Right
Next row

The following code snippets (auto-collected from DevExpress Examples) contain references to the TableAlignment 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#L54

csharp
table.TableAlignment = TableRowAlignment.Center;
table.TableLayout = TableLayoutType.Fixed;

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

csharp
table.TableAlignment = TableRowAlignment.Center;
table.TableLayout = TableLayoutType.Fixed;

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

csharp
// Align the table.
table.TableAlignment = TableRowAlignment.Center;

word-document-api-invoke-print-preview-dialog/VB/Form1.vb#L40

vb
_table.Borders.InsideVerticalBorder.LineStyle = BorderLineStyle.Double
_table.TableAlignment = TableRowAlignment.Center
_table.ForEachCell(Sub(cell, rowIndex, columnIndex) richServer.Document.InsertText(cell.Range.Start, String.Format("{0}*{1} is {2}", rowIndex + 2, columnIndex + 2, (rowIndex + 2) * (columnIndex + 2))))

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

vb
Dim table As DevExpress.XtraRichEdit.API.Native.Table = document.Tables.Create(document.Range.Start, 3, 4)
table.TableAlignment = DevExpress.XtraRichEdit.API.Native.TableRowAlignment.Center
table.TableLayout = DevExpress.XtraRichEdit.API.Native.TableLayoutType.Fixed

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

vb
table.TableAlignment = TableRowAlignment.Center
table.TableLayout = TableLayoutType.Fixed

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

vb
' Align the table.
table.TableAlignment = DevExpress.XtraRichEdit.API.Native.TableRowAlignment.Center
' Set the table width to a fixed value.

See Also

Table Interface

Table Members

DevExpress.XtraRichEdit.API.Native Namespace