Method InsertNote
InsertNote(WordDocument, DocumentPosition, NoteKind)
Inserts a footnote or endnote reference at a position, with the formatting typed there and the note reference style, and a note holding one paragraph in the note text style: its own number mark, then a space. The edit's After is in the note, after the space, where its text is typed.
public static DocumentEdit InsertNote(this WordDocument document, DocumentPosition at, NoteKind kind)
Parameters
documentWordDocumentThe document.
atDocumentPositionWhere the reference goes.
kindNoteKindA footnote or an endnote.
Returns
- DocumentEdit
The edit; undoing it removes the reference, the note and anything it added.
Remarks
As Word does on a document's first note, the edit adds what notes need and the document lacks: the
separator and continuation separator pseudo-notes of both kinds, and the kind's three styles (Footnote
Text, its linked Footnote Text Char and Footnote Reference, or the endnote ones) with
Word's definitions. The note's number is its reference's place in the document, as layout counts it; its
id is one more than the largest the kind has.
Exceptions
- ArgumentNullException
documentis null.- ArgumentException
The position is not in the document.
- ArgumentOutOfRangeException
kindis not defined.- InvalidOperationException
The position is in a header, footer, note or text box, where Word does not insert a note, or inside a surrogate pair or synthesized content.