Field.CodeRange Property
Gets the range containing the field codes.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v18.2.Core.dll
Declaration
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.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/winforms-richedit-document-api-e5219
document.BeginUpdate()
'Create a DATE field at the caret position
document.Fields.Create(document.CaretPosition, "DATE")
document.EndUpdate()
For i As Integer = 0 To document.Fields.Count - 1
Dim fieldCode As String = document.GetText(document.Fields(i).CodeRange)
If fieldCode = "DATE" Then
'Retrieve the range obtained by the field code
Dim position As DocumentPosition = document.Fields(i).CodeRange.End
'Insert the format switch to the end of the field code range
document.InsertText(position, "\@ ""M/d/yyyy h:mm am/pm""")
End If
Next i
'Update all document fields
document.Fields.Update()
Related GitHub Examples
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.