Back to Devexpress

Field.Range Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-field-554f642b.md

latest4.5 KB
Original Source

Field.Range Property

Returns the document range the field occupies.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

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

Property Value

TypeDescription
DocumentRange

The document range that contains the field (including its code and result).

|

Remarks

Use the Field.CodeRange property to obtain the field code’s range, and the Field.ResultRange property to retrieve the field result’s range.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Range 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-table-of-contents-practical-guide/CS/Form1.cs#L93

csharp
Field field = Document.Fields.Create(Document.Paragraphs[(insertHeading ? 1 : 0)].Range.Start, "TOC " + switches);
CharacterProperties cp = Document.BeginUpdateCharacters(field.Range);
cp.Bold = false;

winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Export.cs#L88

csharp
exportOptions.FieldResultEndMarker = "]";
    plainText = document.GetText(item.Range, exportOptions);
}

word-processing-table-of-contents-practical-guide/CS/Program.cs#L125

csharp
Field field = document.Fields.Create(document.Paragraphs[(insertHeading ? 1 : 0)].Range.Start, "TOC " + switches);
CharacterProperties cp = document.BeginUpdateCharacters(field.Range);
cp.Bold = false;

winforms-richedit-table-of-contents-practical-guide/VB/Form1.vb#L85

vb
Dim field As Field = Document.Fields.Create(Document.Paragraphs(If(insertHeading, 1, 0)).Range.Start, "TOC " & switches)
Dim cp As CharacterProperties = Document.BeginUpdateCharacters(field.Range)
cp.Bold = False

winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Export.vb#L78

vb
exportOptions.FieldResultEndMarker = "]"
    plainText = document.GetText(item.Range, exportOptions)
End If

word-processing-table-of-contents-practical-guide/VB/Program.vb#L122

vb
Dim field As Field = document.Fields.Create(document.Paragraphs(If(insertHeading, 1, 0)).Range.Start, "TOC " & switches)
Dim cp As CharacterProperties = document.BeginUpdateCharacters(field.Range)
cp.Bold = False

See Also

CodeRange

ResultRange

Field Interface

Field Members

DevExpress.XtraRichEdit.API.Native Namespace