Table of Contents

Class DocxMailMergeTemplate

Namespace
DocToolkit
Assembly
DocToolkit.Docx.dll

What a mail-merge template asks for, read without merging anything.

public sealed class DocxMailMergeTemplate
Inheritance
DocxMailMergeTemplate
Inherited Members

Remarks

The question this answers is "what does this template want, and is it sound?" — which is the first thing anyone integrating a template somebody else authored needs, and the only way to tell a template with no merge fields apart from one whose fields are all about to go unfilled. A document with no merge fields is not an error: it reports no field names and IsValid true, because there is nothing wrong with it.

Properties

ConditionalBlockNames

The distinct conditional-block names this template asks for — the Name in every {{#Name}} marker pair. See MergeConditional(byte[], IReadOnlyDictionary<string, bool>).

public IReadOnlyList<string> ConditionalBlockNames { get; }

Property Value

IReadOnlyList<string>

FieldNames

The distinct merge-field names this template asks for.

public IReadOnlyList<string> FieldNames { get; }

Property Value

IReadOnlyList<string>

Remarks

Fields that are not MERGEFIELDs are not listed — measured with a DATE field, which is correctly ignored. A field carrying a formatting switch, such as # "#,##0.00", is listed under its own name.

IsValid

Whether the template is sound. False means Issues is non-empty.

public bool IsValid { get; }

Property Value

bool

Remarks

This says nothing about whether a merge will be complete — that depends on the values supplied, and is what IsComplete answers.

Issues

Everything wrong with the template, in document order. Empty when there is nothing.

public IReadOnlyList<DocxMailMergeIssue> Issues { get; }

Property Value

IReadOnlyList<DocxMailMergeIssue>

RepeatingBlockNames

The distinct repeating-block names this template asks for — the Name in every {{#each Name}} marker pair. See MergeRepeating(byte[], IReadOnlyDictionary<string, IEnumerable<IReadOnlyDictionary<string, string>>>).

public IReadOnlyList<string> RepeatingBlockNames { get; }

Property Value

IReadOnlyList<string>

Remarks

Flat across nesting depth. A marker nested inside another appears in this list exactly like a top-level one, with nothing indicating which marker it is nested inside — measured. A caller reasoning about MergeRepeatingRegions(byte[], IReadOnlyDictionary<string, IEnumerable<DocxMailMergeBlockData>>)'s nested shape from this list alone cannot tell nesting apart from two independent regions.