Back to Devexpress

Table.TextWrappingType Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-table-77b7619c.md

latest9.0 KB
Original Source

Table.TextWrappingType Property

Specifies the text wrapping type.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
TableTextWrappingType TextWrappingType { get; set; }
vb
Property TextWrappingType As TableTextWrappingType

Property Value

TypeDescription
TableTextWrappingType

An enumeration value that indicates which text wrapping is used.

|

Available values:

NameDescription
None

The text is not wrapped around the table.

| | Around |

The text is wrapped around the table.

|

Remarks

Note

You can specify the TextWrappingType property for tables in the main body, headers or footers only.

Set the TextWrappingType property to TableTextWrappingType.Around to wrap text around the table and use the following properties to specify the table position:

Horizontal position:

Vertical position:

Distance from surrounding text:

The code sample below shows how to wrap text around a table and specify its position:

csharp
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
using DevExpress.Office.Utils;

using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer())
{
  Document document = wordProcessor.Document;
  Table table = document.Tables[0];
  table.BeginUpdate();

  // Wrap text around the table
  table.TextWrappingType = TableTextWrappingType.Around;

  // Specify vertical alignment:
  table.RelativeVerticalPosition = TableRelativeVerticalPosition.Paragraph;
  table.VerticalAlignment = TableVerticalAlignment.None;
  table.OffsetYRelative = Units.InchesToDocumentsF(2f);

  // Specify horizontal alignment:
  table.RelativeHorizontalPosition = TableRelativeHorizontalPosition.Margin;
  table.HorizontalAlignment = TableHorizontalAlignment.Center;

  // Set distance between the text and the table:
  table.MarginBottom = Units.InchesToDocumentsF(0.3f);
  table.MarginLeft = Units.InchesToDocumentsF(0.3f);
  table.MarginTop = Units.InchesToDocumentsF(0.3f);
  table.MarginRight = Units.InchesToDocumentsF(0.3f);
  table.EndUpdate();
}
vb
Imports DevExpress.XtraRichEdit
Imports DevExpress.XtraRichEdit.API.Native
Imports DevExpress.Office.Utils

Using wordProcessor As New RichEditDocumentServer()
  Dim document As Document = wordProcessor.Document
  Dim table As Table = document.Tables(0)
  table.BeginUpdate()

  ' Wrap text around the table
  table.TextWrappingType = TableTextWrappingType.Around

  ' Specify vertical alignment:
  table.RelativeVerticalPosition = TableRelativeVerticalPosition.Paragraph
  table.VerticalAlignment = TableVerticalAlignment.None
  table.OffsetYRelative = Units.InchesToDocumentsF(2F)

  ' Specify horizontal alignment:
  table.RelativeHorizontalPosition = TableRelativeHorizontalPosition.Margin
  table.HorizontalAlignment = TableHorizontalAlignment.Center

  ' Set distance between the text and the table:
  table.MarginBottom = Units.InchesToDocumentsF(0.3F)
  table.MarginLeft = Units.InchesToDocumentsF(0.3F)
  table.MarginTop = Units.InchesToDocumentsF(0.3F)
  table.MarginRight = Units.InchesToDocumentsF(0.3F)
  table.EndUpdate()
End Using

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

csharp
table.BeginUpdate();
table.TextWrappingType = TableTextWrappingType.Around;

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

csharp
table.BeginUpdate();
table.TextWrappingType = TableTextWrappingType.Around;

winforms-richedit-tables-simple-example/CS/TablesSimpleExample/Form1.cs#L83

csharp
// Wrap text around the table
table.TextWrappingType = TableTextWrappingType.Around;

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

csharp
// Specifies the text wrapping type.
table.TextWrappingType = TableTextWrappingType.Around;

word-document-api-table-examples/CS/Program.cs#L218

csharp
//Wrap text around the table
table.TextWrappingType = TableTextWrappingType.Around;

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

vb
table.BeginUpdate()
table.TextWrappingType = DevExpress.XtraRichEdit.API.Native.TableTextWrappingType.Around
'Specify vertical alignment:

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

vb
table.BeginUpdate()
table.TextWrappingType = TableTextWrappingType.Around

winforms-richedit-tables-simple-example/VB/TablesSimpleExample/Form1.vb#L68

vb
' Wrap text around the table
table.TextWrappingType = TableTextWrappingType.Around
' Specify vertical alignment:

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

vb
' Specifies the text wrapping type.
table.TextWrappingType = DevExpress.XtraRichEdit.API.Native.TableTextWrappingType.Around
' Specify vertical alignment.

word-document-api-table-examples/VB/Program.vb#L176

vb
'Wrap text around the table
table.TextWrappingType = TableTextWrappingType.Around
'Specify vertical alignment:

See Also

Table Interface

Table Members

DevExpress.XtraRichEdit.API.Native Namespace