Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Field.CodeInterval Property

Gets the text buffer interval that contains the field’s code.

Namespace: DevExpress.Blazor.RichEdit

Assembly: DevExpress.Blazor.RichEdit.v24.2.dll

NuGet Package: DevExpress.Blazor.RichEdit

#Declaration

C#
public Interval CodeInterval { get; }

#Property Value

Type Description
Interval

The text buffer interval.

#Remarks

A field has the {Code}Result> structure in the text buffer, for instance, {DATE}11/2/2020>. Use the CodeInterval property to get the text buffer interval that contains the field code.

The following example shows how you can use the CodeInterval property to update only FILLIN fields:

Razor
<DxRichEdit @ref="@richEdit" />

@code {
    DxRichEdit richEdit;
    Document documentAPI;
    @* ... *@
    /* Surround the code that contains an asynchronous operation with a try-catch block to handle
    the OperationCanceledException. This exception is thrown when an asynchronous operation is canceled. */
        try {
            documentAPI = richEdit.DocumentAPI;
            @* ... *@
            IReadOnlyList<Field> fields = await documentAPI.Fields.GetAllAsync();
            foreach (Field currentField in fields) {
                TextSpan fieldCode = await documentAPI.GetTextSpanAsync(currentField.CodeInterval);
                if (fieldCode.Text.Contains("FILLIN"))
                    await documentAPI.Fields.UpdateAsync(currentField);
            }
            @* ... *@
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}

The ResultInterval property allows you to get the text buffer interval that contains the field’s result. Use a field’s Interval property to get an entire field interval.

See Also