Footnotes and endnotes
Add footnotes and endnotes to traditional, paginated documents. A footnote is laid out on its reference page; an endnote is placed according to the document’s endnote settings. Modern documents are not supported by this API.
Installation
Add these plugins to an existing Docs editor with a configured license. Load the UI styles and the locale matching the editor.
UniverDocsAdvancedPreset already includes both plugins. When using that preset, keep its registration instead of adding the plugins again.
pnpm add @univerjs-pro/docs-reference @univerjs-pro/docs-reference-uinpm install @univerjs-pro/docs-reference @univerjs-pro/docs-reference-uiyarn add @univerjs-pro/docs-reference @univerjs-pro/docs-reference-uibun add @univerjs-pro/docs-reference @univerjs-pro/docs-reference-uiimport { UniverDocsReferencePlugin } from '@univerjs-pro/docs-reference'import { UniverDocsReferenceUIPlugin } from '@univerjs-pro/docs-reference-ui'import ReferenceLocale from '@univerjs-pro/docs-reference-ui/locale/en-US'import { LocaleType } from '@univerjs/core'import '@univerjs-pro/docs-reference/facade'import '@univerjs-pro/docs-reference-ui/lib/index.css'univerAPI.loadLocales(LocaleType.EN_US, ReferenceLocale)univer.registerPlugin(UniverDocsReferencePlugin)univer.registerPlugin(UniverDocsReferenceUIPlugin)Insert and manage notes
const document = univerAPI.getActiveDocument()if (document) { const noteId = document.insertFootnote(0) if (noteId) console.log(document.getParagraphs(noteId)) console.log(document.getFootnotes(), document.getEndnotes())}The offset is a UTF-16 position in the main body, including structural tokens. An invalid position, invalid note content, insufficient permission, or a modern document makes insertion return null. A successful insertion returns a stable note ID. The reference and note content participate in the same undo and collaboration mutation.
Use getFootnotes() / getEndnotes() to read notes and deleteFootnote(noteId) / deleteEndnote(noteId) to remove them. setFootnoteSettings() and setEndnoteSettings() configure numbering and placement; passing null resets explicit settings. Keep the returned note ID for addressing content; displayed numbers can change after pagination.
How is this guide?