officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-field-f349622a.md
Gets or sets whether to show the field’s codes.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
bool ShowCodes { get; set; }
Property ShowCodes As Boolean
| Type | Description |
|---|---|
| Boolean |
true to show the field’s codes; otherwise, false.
|
The code snippet below displays field codes for all fields in the main document body:
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
//...
using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer())
{
// Access a document.
Document document = wordProcessor.Document;
// Load a document from the file.
document.LoadDocument("MailMergeSimple.docx", DocumentFormat.Docx);
// Check all fields in the main document body.
for (int i = 0; i < document.Fields.Count; i++)
{
// Show field codes.
document.Fields[i].ShowCodes = true;
}
}
Imports DevExpress.XtraRichEdit
Imports DevExpress.XtraRichEdit.API.Native
'...
Using wordProcessor As New RichEditDocumentServer()
' Access a document.
Dim document As Document = wordProcessor.Document
' Load a document from the file.
document.LoadDocument("MailMergeSimple.docx", DocumentFormat.Docx)
' Check all fields in the main document body.
For i As Integer = 0 To document.Fields.Count - 1
' Show field codes.
document.Fields(i).ShowCodes = True
Next i
End Using
The following code snippets (auto-collected from DevExpress Examples) contain references to the ShowCodes 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.
winforms-richedit-use-calculatedocumentvariable-event-to-insert-formatted-content/CS/Form1.cs#L63
doc.BeginUpdate();
foreach (Field f in doc.Fields) f.ShowCodes = true;
doc.EndUpdate();
how-to-use-docvariable-fields/CS/DocumentVariablesExample/Form1.cs#L129
doc.BeginUpdate();
foreach (Field f in doc.Fields) f.ShowCodes = showCodes;
doc.EndUpdate();
winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Field.cs#L77
{
document.Fields[i].ShowCodes = true;
}
wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/DocumentFieldActions.cs#L67
{
document.Fields[i].ShowCodes = true;
}
word-document-api-examples/CS/CodeExamples/FieldActions.cs#L110
// Show field codes.
document.Fields[i].ShowCodes = true;
}
winforms-richedit-use-calculatedocumentvariable-event-to-insert-formatted-content/VB/Form1.vb#L50
For Each f As Field In doc.Fields
f.ShowCodes = True
Next
how-to-use-docvariable-fields/VB/DocumentVariablesExample/Form1.vb#L124
For Each f As Field In doc.Fields
f.ShowCodes = showCodes
Next
winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Field.vb#L63
For i As Integer = 0 To document.Fields.Count - 1
document.Fields(CInt((i))).ShowCodes = True
Next
wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/DocumentFieldActions.vb#L58
For i As Integer = 0 To document.Fields.Count - 1
document.Fields(i).ShowCodes = True
Next i
word-document-api-examples/VB/CodeExamples/FieldActions.vb#L91
' Show field codes.
document.Fields(CInt((i))).ShowCodes = True
Next
See Also