Table of Contents

Method InsertIndex

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

InsertIndex(WordDocument, DocumentPosition, IndexOptions?, FieldUpdateOptions?)

Inserts an index at a position, as one undoable edit (Word's Insert Index): the INDEX field and its entries in a continuous section of their own with the columns asked for (space 720), the section after it continuous with the columns it had; mid-paragraph, the paragraph is split there.

public static DocumentEdit InsertIndex(this WordDocument document, DocumentPosition at, IndexOptions? options = null, FieldUpdateOptions? fieldOptions = null)

Parameters

document WordDocument

The document that holds the position.

at DocumentPosition

Where the index goes: in a paragraph directly in a section's body.

options IndexOptions

The layout, or null for Word's defaults (2 columns, no headings, page numbers after ", ").

fieldOptions FieldUpdateOptions

The entries' page numbers (PageNumberAt) and the sort's culture, or null for none and invariant.

Returns

DocumentEdit

The edit; After is the start of the paragraph after the index.

Exceptions

ArgumentNullException

document is null.

ArgumentException

The position is not in document, or a value of the options is not defined.

ArgumentOutOfRangeException

The columns are not 1 to 4.

InvalidOperationException

The position is not in a paragraph directly in a section's body.