Table of Contents

Method GetMergeFieldNames

Namespace
DocWright.MailMerge
Assembly
DocWright.MailMerge.dll

GetMergeFieldNames(WordDocument)

Lists the merge fields in a document, without merging anything.

public static IReadOnlyList<string> GetMergeFieldNames(this WordDocument document)

Parameters

document WordDocument

The 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

document is null.