Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

Field.CodeRange Property

Gets the range containing the field codes.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Package: DevExpress.RichEdit.Core

Declaration

DocumentRange CodeRange { get; }

Property Value

Type Description
DocumentRange

A DocumentRange object representing the range occupied by the field’s code.

Remarks

Use the CodeRange method to check field codes or to modify them.

Document document = server.Document;
document.BeginUpdate();
document.Fields.Create(document.CaretPosition, "DATE");
document.EndUpdate();
for (int i = 0; i < document.Fields.Count; i++)
{
    string fieldCode = document.GetText(document.Fields[i].CodeRange);
    if (fieldCode == "DATE")
    {
        DocumentPosition position = document.Fields[i].CodeRange.End;
        document.InsertText(position, @" \@ ""M / d / yyyy HH: mm:ss""");
    }
}
document.Fields.Update();

The following code snippets (auto-collected from DevExpress Examples) contain references to the CodeRange 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.

See Also