DOCX

References

Table of contents, footnotes, endnotes, and bibliography

Table of Contents

Insert a TOC field that Word applications can update:

import { Document, Paragraph, TableOfContents, TextRun } from "@office-open/docx";

const doc = new Document({
    sections: [
        {
            children: [
                new Paragraph({
                    heading: "Heading1",
                    children: [new TextRun("Table of Contents")],
                }),
                new TableOfContents("Table of Contents", {
                    hyperlink: true,
                    headingStyleRange: "1-3",
                }),
            ],
        },
    ],
});

Footnotes

Add footnotes at the bottom of pages:

import { Document, Paragraph, TextRun, FootnoteReferenceRun } from "@office-open/docx";

const doc = new Document({
    footnotes: {
        1: { children: [new Paragraph("This is the first footnote.")] },
        2: { children: [new Paragraph("This is the second footnote.")] },
    },
    sections: [
        {
            children: [
                new Paragraph({
                    children: [
                        new TextRun("A statement with a footnote"),
                        new FootnoteReferenceRun(1),
                        new TextRun(" and another"),
                        new FootnoteReferenceRun(2),
                        new TextRun("."),
                    ],
                }),
            ],
        },
    ],
});

Endnotes

Endnotes appear at the end of the document or section:

import { EndnoteReferenceRun } from "@office-open/docx";

const doc = new Document({
    endnotes: {
        1: { children: [new Paragraph("This is an endnote.")] },
    },
    sections: [
        {
            children: [
                new Paragraph({
                    children: [new TextRun("Text with an endnote"), new EndnoteReferenceRun(1)],
                }),
            ],
        },
    ],
});

Bibliography

Add a bibliography section for citations:

import { Bibliography } from "@office-open/docx";

// Bibliography entries are typically defined via XML sources
// and referenced through citation fields in the document
Copyright © 2026