Basically i am trivarsing whole word document template and updating the text of merge field run.
But after updating the text i want to delete the merge field. How to do that?
var currentDocument = document.EnumerateChildrenOfType<DocumentElementBase>().ToList();
int indexElement = 0;
foreach (var currentElement in currentDocument)
{
if (currentElement.GetType() == typeof(Run))
{
currentRun = (Run)currentElement;
if (currentRun.Text.StartsWith("«") && currentRun.Text.Length > 2)
{
string runText= currentRun.Text.Substring(1, currentRun.Text.Length - 2);
if(runText == "name")
currentRun.Text = "faraz";
}
Now after updating the text i want to delete the merge field and maintain the run text. How to do that?