PPTX

Headers and Footers

Add dates, slide numbers, and custom text to slide footers

Use HeaderFooter to add consistent metadata across slides — dates, slide numbers, and custom text.

Presentation-Level Header/Footer

Apply headers and footers to all slides via Presentation:

import { Presentation, Slide, Shape, HeaderFooter, Paragraph, TextRun } from "@office-open/pptx";

const pres = new Presentation({
    slides: [
        new Slide({
            children: [
                new Shape({
                    x: 1,
                    y: 1,
                    width: 8,
                    height: 5,
                    text: "Content slide",
                }),
            ],
        }),
        new Slide({
            children: [
                new Shape({
                    x: 1,
                    y: 1,
                    width: 8,
                    height: 5,
                    text: "Another slide",
                }),
            ],
        }),
    ],
    headerFooter: new HeaderFooter({
        dateTime: "2025-01-15",
        footer: "Confidential",
        slideNumber: true,
    }),
});

HeaderFooter Options

PropertyTypeDescription
dateTimestringDate/time text to display
footerstringCustom footer text
slideNumberbooleanShow slide number
headerstringHeader text (for notes/handouts)

Slide-Level Override

Override the presentation header/footer on individual slides:

new Slide({
    children: [new Shape({ x: 1, y: 1, width: 8, height: 5, text: "Special slide" })],
    headerFooter: new HeaderFooter({
        footer: "Draft — Not for Distribution",
        slideNumber: false, // Hide slide number on this slide
    }),
});

Per-Slide Header/Footer

Apply header/footer only to specific slides:

new Slide({
    children: [],
    headerFooter: new HeaderFooter({
        dateTime: "January 2025",
        footer: "Internal Use Only",
        slideNumber: true,
    }),
});

Full Example

import {
    Presentation,
    Slide,
    Shape,
    Paragraph,
    TextRun,
    HeaderFooter,
    Packer,
} from "@office-open/pptx";
import fs from "node:fs";

const pres = new Presentation({
    title: "Quarterly Report",
    creator: "Finance Team",
    headerFooter: new HeaderFooter({
        dateTime: "Q4 2025",
        footer: "Confidential",
        slideNumber: true,
    }),
    slides: [
        new Slide({
            children: [
                new Shape({
                    x: 1,
                    y: 1,
                    width: 8,
                    height: 2,
                    paragraphs: [
                        new Paragraph({
                            alignment: "center",
                            children: [
                                new TextRun({ text: "Q4 2025 Report", fontSize: 36, bold: true }),
                            ],
                        }),
                    ],
                }),
            ],
        }),
        new Slide({
            children: [new Shape({ x: 1, y: 1, width: 8, height: 4, text: "Slide content" })],
        }),
    ],
});

const buffer = await Packer.toBuffer(pres);
fs.writeFileSync("report.pptx", buffer);
Copyright © 2026