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.
Slide-Level Header/Footer
Apply headers and footers on individual slides:
{
"slides": [
{
"headerFooter": {
"dateTime": true,
"footer": "Confidential",
"slideNumber": true
},
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "21.2cm",
"height": "9.3cm",
"textBody": { "text": "Content slide" }
}
}
]
}
]
}
import { generatePresentation } from "@office-open/pptx";
generatePresentation({
slides: [
{
headerFooter: {
dateTime: true,
footer: "Confidential",
slideNumber: true,
},
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "21.2cm",
height: "9.3cm",
textBody: { text: "Content slide" },
},
},
],
},
],
});
HeaderFooter Options
| Property | Type | Description |
|---|---|---|
dateTime | boolean | Show/hide date/time placeholder |
footer | string | boolean | Footer text, or true to show placeholder |
slideNumber | boolean | Show/hide slide number |
header | boolean | Show/hide header placeholder |
Slide-Level Override
Override the header/footer on individual slides:
{
"slides": [
{
"headerFooter": {
"footer": "Draft — Not for Distribution",
"slideNumber": false
},
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "21.2cm",
"height": "9.3cm",
"textBody": { "text": "Special slide" }
}
}
]
}
]
}
import { generatePresentation } from "@office-open/pptx";
generatePresentation({
slides: [
{
headerFooter: {
footer: "Draft — Not for Distribution",
slideNumber: false,
},
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "21.2cm",
height: "9.3cm",
textBody: { text: "Special slide" },
},
},
],
},
],
});
Full Example
{
"title": "Quarterly Report",
"creator": "Finance Team",
"slides": [
{
"headerFooter": {
"dateTime": true,
"footer": "Confidential",
"slideNumber": true
},
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "21.2cm",
"height": "5.3cm",
"textBody": {
"children": [
{
"properties": { "alignment": "CENTER" },
"children": [{ "text": "Q4 2025 Report", "size": 36, "bold": true }]
}
]
}
}
}
]
}
]
}
import { generatePresentation } from "@office-open/pptx";
import * as fs from "node:fs";
const buffer = await generatePresentation({
title: "Quarterly Report",
creator: "Finance Team",
slides: [
{
headerFooter: {
dateTime: true,
footer: "Confidential",
slideNumber: true,
},
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "21.2cm",
height: "5.3cm",
textBody: {
children: [
{
properties: { alignment: "CENTER" },
children: [{ text: "Q4 2025 Report", size: 36, bold: true }],
},
],
},
},
},
],
},
],
});
fs.writeFileSync("report.pptx", buffer);