Footnotes and endnotes

Insert, read, convert, and delete DOCX footnotes and endnotes.

The editor renders DOCX footnotes and endnotes in their document locations and edits note text on the same surface.

Insert a note

Run insertNote to add a reference at the caret and open the new note body:

editor.exec({ type: 'insertNote', noteKind: 'footnote' });
noteKindChrome slot
footnoteinsert.footnote
endnoteinsert.endnote

React and Vue share these slots. The Insert menu offers the same commands. In suggesting mode, the inserted reference is tracked.

Read and edit notes

Use the Office.js-shaped Body.footnotes and Body.endnotes collections in automation. Read note text in two batches:

const notes = await runtime.run(async (context) => {
  const collection = context.document.body.footnotes;
  collection.load('items');
  await context.sync();
  for (const note of collection.items) note.load(['type', 'text']);
  await context.sync();
  return collection.items.map((note) => ({ type: note.type, text: note.text }));
});

Use note.body to edit a note. Separate writes to different notes with context.sync(). Document.footnotes and Document.endnotes are DocxEditor extensions, outside the Office.js document model.

In the browser, these APIs expose the active note:

APIPurpose
useNoteScopeState()Reads the active note scope in React or Vue.
DocxEditor.NotesChromePackaged note controls for React.
DocxEditorNotesChromePackaged note controls for Vue.

Paragraph.delete() removes one paragraph of a note, and deleting a table inside a note removes it. Each note keeps at least one paragraph. Deleting its last paragraph fails with NotSupported and edit.content-required, so call Paragraph.clear() instead. The first paragraph of a note holds the note's reference number, and deleting that paragraph removes the number with it.

Text, lists, tables, pictures, and bookmarks work inside a note. Comments need the review module and an EigenPal Pro License.

Select across notes

All footnotes form one story, and all endnotes form another. A selection that starts in a note extends into the next notes of the same kind when you drag, Shift+click, or press Shift with an arrow key. The open note follows the caret.

Over a selection that spans notes, copy and formatting work. Typing, deleting, pasting, and cutting are refused, because they would merge the notes. The refusal reason is in snapshot().lastRejection.

Convert or delete a note

The packaged note controls convert a footnote to an endnote, or an endnote to a footnote. In edit mode, deleting a note removes its reference and body, then renumbers later notes.

In automation, NoteItem.delete() removes the note and its references. Run note deletion alone in its own sync, after all pending reads and writes.

Suggesting mode refuses direct note deletion. Delete the reference to propose note removal.

Limits

  • Automation does not create notes or format reference numbers.
  • Notes inside headers and footers are not supported.
  • Imported note revisions stay in the round-trip document.
  • If a continuation notice exceeds the available page height or leaves no room for continuing text, the editor omits it. The note continues, and the footnote area reports note-continuation-notice-height-cap.
  • Numbering, placement, table rows, and continuation notices follow DOCX fidelity.

See also