Back to Devexpress

Document.UnlinkAllFields() Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-document-2f66d2e7.md

latest3.4 KB
Original Source

Document.UnlinkAllFields() Method

Replaces all document fields with field values.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
void UnlinkAllFields()
vb
Sub UnlinkAllFields

Remarks

The Unlink method converts fields’ results to text or graphics. Unlinked fields can not be updated automatically.

Use the Field.Unlink method to unlink a field. The FieldCollection.Unlink method allows you to unlink all fields in specific parts of a document (main body, text box, header, footer, comment, footnote, and endnote).

The code sample below unlinks all fields in the document.

csharp
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
//...

using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer())
{
    // Access a document.
    Document document = wordProcessor.Document;
    //...
    // Unlink all fields in the document.
    document.UnlinkAllFields();
}
vb
Imports DevExpress.XtraRichEdit
Imports DevExpress.XtraRichEdit.API.Native
'...

Using wordProcessor As New RichEditDocumentServer()
    ' Access a document.
    Dim document As Document = wordProcessor.Document
    '...
    ' Unlink all fields in the document.
    document.UnlinkAllFields()
End Using

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the UnlinkAllFields() method.

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.

how-to-replace-document-fields-with-their-values/CS/Form1.cs#L34

csharp
private void FieldsToValues(RichEditControl control) {
    control.Document.UnlinkAllFields();
}

how-to-replace-document-fields-with-their-values/VB/Form1.vb#L32

vb
Private Sub FieldsToValues(ByVal control As RichEditControl)
    control.Document.UnlinkAllFields()
End Sub

See Also

Document Interface

Document Members

DevExpress.XtraRichEdit.API.Native Namespace