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. Image for the cookie policy date

find and delete mergefield in existing word document

Hi,

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

3 Replies

VR Vijay Ramachandran Syncfusion Team 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.
http://www.syncfusion.com/downloads/support/forum/128918/ze/RenameOrRemoveMergeField-1187639448.zip

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.

Regards,
Vijay R



MB Martin Bach February 17, 2017 09:51 AM UTC

thank you very much!

works like a charm!


VR Vijay Ramachandran Syncfusion Team 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.

Regards,
Vijay R
 


Loader.
Up arrow icon