Back to Devexpress

TableCell.ContentRange Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-tablecell-8212fdf4.md

latest4.9 KB
Original Source

TableCell.ContentRange Property

Gets the document range that contains the cell content (excluding the table paragraph mark).

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
DocumentRange ContentRange { get; }
vb
ReadOnly Property ContentRange As DocumentRange

Property Value

TypeDescription
DocumentRange

The range with the cell content.

|

Remarks

The ContentRange property returns the range with the cell content. Use the Range property to obtain the range occupied by the whole table cell, including the table paragraph mark.

The image below illustrates the difference between Range and ContentRange values:

Use the ContentRange property to append content to the cell, as shown below:

csharp
Table table = document.Tables[0];

//Apply formatting to the first cell
CharacterProperties properties = document.BeginUpdateCharacters(table[0, 1].ContentRange);
properties.FontName = "Segoe UI";
properties.FontSize = 16;
document.EndUpdateCharacters(properties);
ParagraphProperties alignment = document.BeginUpdateParagraphs(table[0, 1].ContentRange);
alignment.Alignment = ParagraphAlignment.Center;
document.EndUpdateParagraphs(alignment);
vb
' Apply formatting to the first cell
Dim properties As CharacterProperties = document.BeginUpdateCharacters(table(0, 1).ContentRange)
properties.FontName = "Segoe UI"
properties.FontSize = 16
document.EndUpdateCharacters(properties)
Dim alignment As ParagraphProperties = document.BeginUpdateParagraphs(table(0, 1).ContentRange)
alignment.Alignment = ParagraphAlignment.Center
document.EndUpdateParagraphs(alignment)

The following code snippets (auto-collected from DevExpress Examples) contain references to the ContentRange 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-tables-simple-example/CS/TablesSimpleExample/Form1.cs#L129

csharp
// Apply formatting to the "Active Customers" cell
CharacterProperties properties = document.BeginUpdateCharacters(table[0, 2].ContentRange);
properties.FontName = "Segoe UI";

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

csharp
//Apply formatting to the "Active Customers" cell
CharacterProperties properties = document.BeginUpdateCharacters(table[0, 1].ContentRange);
properties.FontName = "Segoe UI";

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

vb
' Apply formatting to the "Active Customers" cell
Dim properties As CharacterProperties = document.BeginUpdateCharacters(table(0, 2).ContentRange)
properties.FontName = "Segoe UI"

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

vb
'Apply formatting to the "Active Customers" cell
Dim properties As CharacterProperties = document.BeginUpdateCharacters(table(0, 1).ContentRange)
properties.FontName = "Segoe UI"

See Also

Word Processing File API Tables Example

TableCell Interface

TableCell Members

DevExpress.XtraRichEdit.API.Native Namespace