Skip to main content

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

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:

<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