We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

find and delete mergefield in existing word document

Thread ID:





128918 Feb 15,2017 04:14 PM UTC Feb 20,2017 04:47 AM UTC ASP.NET MVC 3
Tags: DocIO
Martin Bach
Asked On February 15, 2017 04:14 PM UTC


I'd like to find and delete a MergeField in an existing Word Document.

The Mergefield always has the Name "sbw2".

Alternatively I would like to rename this Mergefield to "sbw".

Is this possible?

Thank You in advance

Vijay Ramachandran [Syncfusion]
Replied On February 16, 2017 09:51 AM UTC

Hi Martin,

Thank you for using Syncfusion products.

Yes, you can remove or rename particular merge field from the Word document using WordDocument.Find() method. We have prepared the sample to meet your requirement, please find the sample from below link and let us know if it helps.

In the above sample we have done following things:

  1. Finds the merge field (“test”) which should remove from template document.
  2. Remove this merge field from its owner child entities list collection.
  3. Finds the merge field (“sbw2”) which name should modify.
  4. Change the name of the field as (“sbw”) using WField.FieldName property.

Let us know if you have any concern.

Vijay R

Martin Bach
Replied On February 17, 2017 09:51 AM UTC

thank you very much!

works like a charm!

Vijay Ramachandran [Syncfusion]
Replied On February 20, 2017 04:47 AM UTC

Hi Martin,

Thank you for your update.

We are happy to hear that the provide solution solved your problem. Please let us know if you have any other questions. We will be happy to assist you as always.

Vijay R


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon