Method FindFieldsEverywhere
FindFieldsEverywhere(WordDocument)
Finds every field in a document's body, headers, footers, footnotes and endnotes.
public static IReadOnlyList<FieldRegion> FindFieldsEverywhere(this WordDocument document)
Parameters
documentWordDocumentThe document.
Returns
- IReadOnlyList<FieldRegion>
The fields found, body first.
Remarks
Equivalent to FindFields(DomNode) on the same document, and kept because it names the guarantee a form-filling or merge pass depends on: the fields in a letterhead header are included, and skipping them leaves a document that still looks correct.
It used to append the headers, footers and notes to that walk. They were already in it — Children has been a composite over all four collections since the DOM was written — so every field outside the body was returned twice, and a caller iterating the result acted on each of them twice.
Exceptions
- ArgumentNullException
documentis null.