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

    Constructors

    Methods

    • 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

    • Prepares this component and its children for XML serialization.

      This method is called by the Formatter to convert the component tree into an object structure compatible with the xml library (https://www.npmjs.com/package/xml). It recursively processes all children and handles special cases like attribute-only elements and empty elements.

      The method can be overridden by subclasses to customize XML representation or execute side effects during serialization (e.g., creating relationships).

      Parameters

      • context: IContext

        The serialization context containing document state

      Returns IXmlableObject | undefined

      The XML-serializable object, or undefined to exclude from output

      // Override to add custom serialization logic
      prepForXml(context: IContext): IXmlableObject | undefined {
      // Custom logic here
      return super.prepForXml(context);
      }