Table of Contents

Method AddBookmark

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

AddBookmark(WordDocument, DocumentSpan, string)

Insert > Bookmark, Add, as one undoable edit: a bookmark round the span (empty at a caret). A bookmark of the same name, compared ignoring case, is moved here and takes the new name's case, as Word does (WQ-0111).

public static DocumentEdit AddBookmark(this WordDocument document, DocumentSpan span, string name)

Parameters

document WordDocument

The document.

span DocumentSpan

The selection, or a caret.

name string

The name (IsValidBookmarkName(string?)).

Returns

DocumentEdit

The edit; the selection is kept.

Exceptions

ArgumentNullException

document or name is null.

ArgumentException

The span is not in the document, or the name is not one Word takes.

InvalidOperationException

An end is in a shape's text box or inside synthesized content.