Class BookmarkEditingExtensions
Finds bookmarks and edits the content they span.
public static class BookmarkEditingExtensions
- Inheritance
-
BookmarkEditingExtensions
- Inherited Members
Fields
- MaxBookmarkNameLength
The longest bookmark name Word's Bookmark dialog takes.
Methods
- 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).
- Bookmark(DocumentRange, string)
Wraps a range of inlines in a new bookmark with a document-unique id.
- DeleteContent(BookmarkReference)
Deletes the content the bookmark spans, leaving both markers in place so the bookmark survives as an insertion point.
When the markers sit in different paragraphs the paragraphs are joined, which is what deleting a range that crosses a paragraph mark means: the mark is part of the deleted range. The surviving paragraph keeps the start paragraph's own formatting.
- FindBookmark(DomNode, string)
Finds a bookmark by name. Names are compared ordinally, as the format defines them.
- FindBookmarks(DomNode)
Returns every complete bookmark in a subtree, in the order their start markers appear. A start marker with no matching end is skipped: it spans nothing that can be edited.
- Insert(BookmarkReference, IReadOnlyList<Inline>, BookmarkInsertPosition)
Inserts inlines at a bookmark, in order.
- InsertText(BookmarkReference, string, BookmarkInsertPosition, CharacterFormat?)
Inserts a text run at a bookmark.
- IsValidBookmarkName(string?)
Gets whether Word takes the name for a bookmark (Insert > Bookmark, WQ-0111): a letter first (or
, a hidden bookmark), then letters, digits and, at most 40 characters; no space, hyphen or dot.
- RemoveBookmark(WordDocument, DocumentPosition, string)
Insert > Bookmark, Delete, as one undoable edit: the bookmark goes, the text it marked stays.
- ReplaceContent(BookmarkReference, string, CharacterFormat?)
Replaces the content the bookmark spans with a single text run.