I am beginner to open xml sdk. I am trying to find out all merge fields of document.
But I am not getting the headers and footers merge fields.
Can any one suggest a working solution?
I am trying some thing like this -
foreach (FieldCode field in docGenerated.MainDocumentPart.RootElement.Descendants<FieldCode>())
{
String fieldText = field.Text;
if (fieldText.StartsWith(" MERGEFIELD"))
{
Int32 endMerge = fieldText.IndexOf("\\");
Int32 fieldNameLength = fieldText.Length - endMerge;
String fieldName = fieldText.Substring(11, endMerge - 11);
fieldName = fieldName.Trim();
}
}