Method GetMergeFieldNames
GetMergeFieldNames(WordDocument)
Lists the merge fields in a document, without merging anything.
public static IReadOnlyList<string> GetMergeFieldNames(this WordDocument document)
Parameters
documentWordDocumentThe template.
Returns
- IReadOnlyList<string>
The distinct merge field names, ordered.
Remarks
Covers the body, headers, footers, footnotes and endnotes: a merge that only walks the
body leaves a letterhead header unmerged, and the document still looks right. Region
markers are excluded -- TableStart:Items is structure, not a field a host would
map to a column.
Exceptions
- ArgumentNullException
documentis null.