Back to Devexpress

Field.ShowCodes Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-field-f349622a.md

latest6.2 KB
Original Source

Field.ShowCodes Property

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

Declaration

csharp
bool ShowCodes { get; set; }
vb
Property ShowCodes As Boolean

Property Value

TypeDescription
Boolean

true to show the field’s codes; otherwise, false.

|

Example

The code snippet below displays field codes for all fields in the main document body:

csharp
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;
    }
}
vb
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

csharp
doc.BeginUpdate();
foreach (Field f in doc.Fields) f.ShowCodes = true;
doc.EndUpdate();

how-to-use-docvariable-fields/CS/DocumentVariablesExample/Form1.cs#L129

csharp
doc.BeginUpdate();
foreach (Field f in doc.Fields) f.ShowCodes = showCodes;
doc.EndUpdate();

winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Field.cs#L77

csharp
{
    document.Fields[i].ShowCodes = true;
}

wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/DocumentFieldActions.cs#L67

csharp
{
    document.Fields[i].ShowCodes = true;
}

word-document-api-examples/CS/CodeExamples/FieldActions.cs#L110

csharp
// Show field codes.
    document.Fields[i].ShowCodes = true;
}

winforms-richedit-use-calculatedocumentvariable-event-to-insert-formatted-content/VB/Form1.vb#L50

vb
For Each f As Field In doc.Fields
    f.ShowCodes = True
Next

how-to-use-docvariable-fields/VB/DocumentVariablesExample/Form1.vb#L124

vb
For Each f As Field In doc.Fields
    f.ShowCodes = showCodes
Next

winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Field.vb#L63

vb
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

vb
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

vb
' Show field codes.
    document.Fields(CInt((i))).ShowCodes = True
Next

See Also

Field Interface

Field Members

DevExpress.XtraRichEdit.API.Native Namespace