Footnotes and Endnotes
Footnotes and endnotes are one feature aimed at two places. A footnote prints at
the bottom of the page carrying its mark, an endnote collects at the end of the
document, and in the file each kind gets its own part: word/footnotes.xml and
word/endnotes.xml. UniOffice mirrors that split exactly, down to matching
method names on Paragraph and Document, so anything true of one is true of
the other.
A note is two objects. The body is a small block of paragraphs living in that
part, reached through the Footnote or Endnote value, and the mark is a run in
the body of the document holding nothing but the note’s id.
AddFootnote creates both and links them; RemoveFootnote deletes both. Between
those, ids are how you get from one to the other: run.IsFootnote() gives you
the id on a mark, and doc.Footnote(id) gives you the body.
The id is not the number the reader sees. UniOffice assigns ids sequentially from 1 and Word derives the printed numbers from the order the marks appear in the text, so the two agree until you remove something. A removal renumbers every remaining note and rewrites the marks that point at them, which keeps the document correct and makes any id you were holding onto stale.
Each part also carries two entries that are not notes, defining the separator
rule Word draws above them. They come back from Footnotes() and Endnotes()
along with the real notes, so the length of those slices is two more than the
count you expect.
Where to look
| Guide | Covers |
|---|---|
| Add Notes | Anchoring a note while building a document, and giving it a body of several paragraphs. |
| Inspect Existing Notes | Finding the notes a file already has, and where the mark lands when you add one. |
| Remove Notes | Deleting a note with its mark, and what the renumbering does afterwards. |