.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

Field.CodeRange Property

Gets the range containing the field codes.

Namespace: DevExpress.XtraRichEdit.API.Native

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

Declaration

DocumentRange CodeRange { get; }
ReadOnly Property CodeRange As DocumentRange
DocumentRange CodeRange { get; }
ReadOnly Property CodeRange As DocumentRange
DocumentRange CodeRange { get; }
ReadOnly Property CodeRange As DocumentRange

Property Value

Type Description
DocumentRange

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

Property Value

Type Description
DocumentRange

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

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();
See Also