General Information
.NET Subscription
Desktop
Web
Controls and Extensions
Mainteinance Mode
Enterprise and Analytic Tools
Quality Assurance and Productivity
Frameworks and Libraries
All docs
V19.2
General Information
.NET Subscription
Desktop
Web
Controls and Extensions
Mainteinance Mode
Enterprise and Analytic Tools
Quality Assurance and Productivity
Frameworks and Libraries
19.2
19.1
18.2
18.1
17.2
.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
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.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/word-processing-document-api-examples-t418535
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();
Dim document As Document = server.Document
document.BeginUpdate()
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
Dim position As DocumentPosition = document.Fields(i).CodeRange.End
document.InsertText(position, " \@ ""M / d / yyyy HH: mm:ss""")
End If
Next i
document.Fields.Update()
See Also
Feedback