Back to Devexpress

Table.RightToLeft Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-table-2ef6ecfc.md

latest4.1 KB
Original Source

Table.RightToLeft Property

Specifies whether to change the table layout’s direction to right-to-left.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
bool RightToLeft { get; set; }
vb
Property RightToLeft As Boolean

Property Value

TypeDescription
Boolean

true , to change the table direction; otherwise, false.

|

Remarks

Set the RightToLeft property to true to reorder table columns and apply the table indent (specified by the Table.Indent property) to the right side of the table. The image below shows the resulting table appearance:

Use the ParagraphProperties.RightToLeft property to change the reading order of cell content, as shown below:

csharp
private void ChangeTableDirection(Document document)
{
  // Create a table:
  Table table = document.Tables.Create(document.Range.End, 2, 2);

  // Change table layout direction:
  table.RightToLeft = true;

  // Change table content direction:
  table.ForEachCell((cell, rowIndex, columnIndex) =>
  {
    // Start cell content update:
    SubDocument cellContent = cell.ContentRange.BeginUpdateDocument();

    // Insert text to each cell:
    cellContent.InsertText(cell.Range.Start, );

    // Access the content's paragraph properties:
    ParagraphProperties paragraphProperties = cellContent.BeginUpdateParagraphs(cellContent.Range);

    // Specify the paragraph's reading order:
    paragraphProperties.RightToLeft = true;

    // Finalize the paragraph's and content's update:
    cellContent.EndUpdateParagraphs(paragraphProperties);
    cell.ContentRange.EndUpdateDocument(cellContent);
  });
vb
Private Sub ChangeTableDirection(ByVal document As Document)
  ' Create a table:
  Dim table As Table = document.Tables.Create(document.Range.[End], 2, 2)

  ' Change table layout direction:
  table.RightToLeft = True

  ' Change table content direction:
  table.ForEachCell(Sub(cell, rowIndex, columnIndex)

    ' Start the cell content update:
    Dim cellContent As SubDocument = cell.ContentRange.BeginUpdateDocument()
    'Insert text to each cell:
    cellContent.InsertText(cell.Range.Start,String.Format("{0},{1}",rowIndex,columnIndex))

    ' Access the content's paragraph properties:
    Dim paragraphProperties As ParagraphProperties = cellContent.BeginUpdateParagraphs(cellContent.Range)

    ' Specify the paragraph's reading order:
    paragraphProperties.RightToLeft = True

    ' Finalize the paragraph's and content's update:
    cellContent.EndUpdateParagraphs(paragraphProperties)
    cell.ContentRange.EndUpdateDocument(cellContent)
  End Sub)

The inserted table’s RightToLeft property value depends on the RightToLeft property value of a paragraph where the table is inserted. If the paragraph’s RightToLeft property is set to true, the table’s RightToLeft property is automatically set to true. The RightToLeft property of all cell paragraphs is also set to true.

See Also

Table Interface

Table Members

DevExpress.XtraRichEdit.API.Native Namespace