Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: How to Remove a MERGEFIELD While Replacing the Placeholders with Values in RadWordsProcessing
description: Learn how to remove a MERGEFIELD from a document while replacing the placeholders with actual values, facilitating the MailMerge process in RadWordsProcessing.
type: how-to
page_title: How to Remove a MERGEFIELD WWhile Replacing the Placeholders with Values in RadWordsProcessing
page_title: How to Remove a MERGEFIELD While Replacing the Placeholders with Values in RadWordsProcessing
slug: remove-mergefields-retain-values-radwordsprocessing
tags: wordsprocessing, document, processing, merge, field, mailmerge, remove
res_type: kb
Expand All @@ -16,15 +16,15 @@ ticketid: 1667593
| 2024.3.806| RadWordsProcessing |[Desislava Yordanova](https://www.telerik.com/blogs/author/desislava-yordanova)|

## Description
When preparing a document for the [MailMerge]({%slug radwordsprocessing-editing-mail-merge%}) operation in RadWordsProcessing, it might be necessary to remove a [MERGEFIELD]({%slug radwordsprocessing-concepts-merge-field%}) without losing its inserted value. This process ensures that the document is clean and ready for MailMerge without encountering issues related to leftover `MERGEFIELD` .
When preparing a document for the [MailMerge]({%slug radwordsprocessing-editing-mail-merge%}) operation in RadWordsProcessing, it might be necessary to remove a [MERGEFIELD]({%slug radwordsprocessing-concepts-merge-field%}) without losing its inserted value. This process ensures that the document is clean and ready for MailMerge without encountering issues related to leftover `MERGEFIELD`.

This KB article also answers the following questions:
- How can I delete `MERGEFIELD` fields but keep their content in the document?
- What is the correct approach to prepare a document for MailMerge in RadWordsProcessing?
- Is there a way to clean up `MERGEFIELD` from a document without affecting its content?

## Solution
To remove a `MERGEFIELD` while retaining their values, you can use the `RadFlowDocumentEditor`'s `DeleteContent` method. This approach involves deleting the field codes but leaving the field values as plain text in the document. Additionally, the [Find and Replace]({%slug radwordsprocessing-editing-find-and-replace%}) functionality provides a straightforward way to handle any leftover text from the fields.
To remove a `MERGEFIELD` while retaining its values, you can use the `RadFlowDocumentEditor`'s `DeleteContent` method. This approach involves deleting the field codes but leaving the field values as plain text in the document. Additionally, the [Find and Replace]({%slug radwordsprocessing-editing-find-and-replace%}) functionality provides a straightforward way to handle any leftover text from the fields.

Here is an example code snippet demonstrating how to accomplish this:

Expand Down