Table of Contents

Method ResolveInstruction

Namespace
DocWright.Dom.Fields
Assembly
DocWright.Dom.dll

ResolveInstruction(Func<FieldInstruction, string?>)

Rebuilds the instruction text, letting the caller decide what each nested field contributes.

public string ResolveInstruction(Func<FieldInstruction, string?> resolveNested)

Parameters

resolveNested Func<FieldInstruction, string>

Returns the text a nested field contributes. Returning null falls back to that field's cached result.

Returns

string

The rebuilt instruction text.

Remarks

InstructionText substitutes each nested field's cached result, which is what Word displays but is stale by definition. A consumer that knows the current value — mail merge knows the record — needs to put that in instead.

This is the only way to read a nested field's own instruction in position. It matters for SKIPIF and NEXTIF, where Word requires the operand to be a nested MERGEFIELD: an unquoted bare name is a literal, so SKIPIF Code = "abc" compares the word "Code" and never fires.

Exceptions

ArgumentNullException

resolveNested is null.