Information about mergefield formatting

Hi,

I need to do some analysis of templates, eg. list all templates containing specific switches or specific formatting, eg. { MERGEFIELD “DocDescription” -#,###.00 } . Could you tell me where this information is stored in Document object?

Thanks,
Ewa

@acturisaspose,

Thanks for your inquiry. You can get field’s code using Field.GetFieldCode method. Moreover, the Field.Format property returns a FieldFormat object that provides typed access to field’s formatting. Please check the following code example. Hope this helps you.

var document = new Document(MyDir + @"in.docx");
FieldMergeField field = (FieldMergeField)document.Range.Fields[0];
Console.WriteLine(field.Format.NumericFormat);
Console.WriteLine(field.GetFieldCode());