Remove merge fields from output documents
Do we have a method in Aspose.Words that will allow us to remove all code fields from a word document? We want to remove merge field codes from several part of the word document not only at the end of the document. We are using Aspose.Words 18.104.22.168
We currenly use the Update/Unlink methods of the Document object using the Word PIA 2002.
Word Iterop 2002
Field object: Replaces the specified field with its most recent result.
Fields object: Replaces all the fields in the Fields collection with their most recent results.
expression Required. An expression that returns a Field or Fields object.
When you unlink a field, it’s current result is converted to text or a graphic and can no longer be updated automatically. Note that some fields — such as XE (Index Entry) fields and SEQ (Sequence) fields — cannot be unlinked.
This example unlinks the first field in “Sales.doc.”
This example updates and unlinks all the fields in the first section in the active document.
With ActiveDocument.Sections(1).Range.Fields .Update .Unlink End With