docx
    Preparing search index...

    Class FootNotes

    Represents the footnotes collection in a WordprocessingML document.

    FootNotes manages all footnotes in a document and automatically creates the required separator and continuation separator footnotes. These special footnotes define the line that separates body text from footnotes and the line used when footnotes continue across pages.

    Reference: http://officeopenxml.com/WPfootnotes.php

    <xsd:complexType name="CT_Footnotes">
    <xsd:sequence maxOccurs="unbounded">
    <xsd:element name="footnote" type="CT_FtnEdn" minOccurs="0"/>
    </xsd:sequence>
    </xsd:complexType>
    // FootNotes is typically managed internally by the Document class
    // Users create footnotes through the Document API
    const doc = new Document({
    sections: [{
    children: [
    new Paragraph({
    children: [
    new TextRun("Text with footnote"),
    new FootnoteReferenceRun(1),
    ],
    }),
    ],
    footnotes: {
    1: {
    children: [new Paragraph("Footnote content")],
    },
    },
    }],
    });

    Hierarchy (View Summary)

    Index
    • get writtenAs(): readonly BaseXmlComponent[] | undefined
      Internal

      The components written in this one's place, one after another, when it can't be written as a single element, such as a run with another run in its children. Undefined when it is written as itself.

      Returns readonly BaseXmlComponent[] | undefined

    • Creates and adds a new footnote to the collection.

      Parameters

      • id: number

        Unique numeric identifier for the footnote

      • paragraph: readonly Paragraph[]

        Array of paragraphs that make up the footnote content

      Returns void

    • Internal

      The id of the footnote that a reference run brings with it, which is added to the footnotes the first time the run is written, with an id no other footnote has. Word has footnotes only in a document's body, so a run written anywhere else, such as in a header, has none, and its footnote isn't added.

      Parameters

      • reference: object

        The run, which has the same footnote each time it is written

      • footnote: NoteContent

        The footnote's content

      • context: IContext

        The context the run is written in

      Returns number | undefined

      The footnote's id, or undefined outside the document's body