Table of Contents

Method InsertMergeField

Namespace
DocWright.Dom.Editing
Assembly
DocWright.Dom.dll

InsertMergeField(WordDocument, DocumentPosition, string)

Inserts a merge field at a position. One undo step.

public static DocumentEdit InsertMergeField(this WordDocument document, DocumentPosition at, string name)

Parameters

document WordDocument

The document that holds the position.

at DocumentPosition

Where the field goes.

name string

The field's name: 1 to 40 letters, digits and underscores (a CSV list's name for a column, as Word makes it).

Returns

DocumentEdit

The edit; After is just past the field.

Exceptions

ArgumentNullException

document or name is null.

ArgumentException

The position is not in the document, or the name is not a field name.

InvalidOperationException

The position is in a shape's text box or inside content a reader synthesized.