officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-field-55a736e6.md
Returns the range that contains the field result.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
DocumentRange ResultRange { get; }
ReadOnly Property ResultRange As DocumentRange
| Type | Description |
|---|---|
| DocumentRange |
The document range the field result occupies.
|
The code sample below checks all field results and inserts “Empty Value!” if the field result is empty:
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
using System.Drawing;
using (var wordProcessor = new RichEditDocumentServer()) {
Document document = wordProcessor.Document;
foreach (Field field in document.Fields) {
string strResult = document.GetText(field.ResultRange);
if (strResult == "") {
document.InsertText(field.ResultRange.Start, "Empty Value!");
}
}
}
``Imports DevExpress.XtraRichEdit
Imports DevExpress.XtraRichEdit.API.Native
Imports System.Drawing
Using wordProcessor = New RichEditDocumentServer()
Dim document As Document = wordProcessor.Document
For Each field As Field In document.Fields
Dim strResult As String = document.GetText(field.ResultRange)
If strResult = "" Then
document.InsertText(field.ResultRange.Start, "Empty Value!")
End If
Next field
End Using
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ResultRange 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/Export.cs#L109
options.AllowExtendingDocumentRange = false;
foreach (Paragraph par in document.Paragraphs.Get(item.ResultRange)) {
plainText += document.GetText(par.Range, options);
winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Export.vb#L97
options.AllowExtendingDocumentRange = False
For Each par As DevExpress.XtraRichEdit.API.Native.Paragraph In document.Paragraphs.[Get](item.ResultRange)
plainText += document.GetText(par.Range, options)
See Also