HHow to replace the below xml with value "current date" and that should be return the result with the formatted value mentioned"dddd, MMMM dd, yyyy".
<w:fldSimple w:instr="MERGEFIELD CurrentDate \@ "dddd, MMMM dd, yyyy"">
</w:p>
I have replaced the value for current date by using the code.But the current date is not displayed in the format"dddd, MMMM dd, yyyy".
if (fldSimples != null)
{
for (int i = (fldSimples.Length) - 1; i >= 0; i--)
{
SimpleField fldSimple = fldSimples[i];
fldContent = fldSimple.InnerText.ToString();
fldContent = fldContent.Substring(1, fldContent.Length - 2);
xmlvalue = XMLdoc.SelectSingleNode(@"//LETTERDATA/" + fldContent);
fldContent = xmlvalue.FirstChild.InnerText;
fieldList += fldContent;
Run r = (Run)fldSimple.Elements<Run>().FirstOrDefault().CloneNode(true);
r.Descendants<Text>().FirstOrDefault().Text = fldContent;
fldSimple.PreviousSibling().Append(r);
fldSimple.RemoveAllChildren();
fldSimple.Remove();
}
}