@office-open/pptx 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +78 -0
- package/dist/_chunks/chunk-C8fdooHg.mjs +29 -0
- package/dist/index.d.mts +1203 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +5448 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Demo Macro
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# @office-open/pptx
|
|
2
|
+
|
|
3
|
+
> Generate .pptx files with JS/TS with a declarative API.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Slide Management** — Create presentations with multiple slides, slide masters, and slide layouts
|
|
8
|
+
- **Shapes** — Rectangles, ellipses, lines, connectors, and custom geometry shapes
|
|
9
|
+
- **Text & Rich Formatting** — Paragraphs, runs, fonts, colors, alignment, and spacing
|
|
10
|
+
- **Tables** — Full table support with rows, cells, borders, and cell properties
|
|
11
|
+
- **Charts** — Bar, line, pie, area, and scatter charts with customization
|
|
12
|
+
- **SmartArt** — Built-in SmartArt graphic generation with multiple layouts and styles
|
|
13
|
+
- **Images** — Inline pictures with fills, transformations, and effects
|
|
14
|
+
- **Backgrounds** — Solid color, gradient, and picture backgrounds
|
|
15
|
+
- **Transitions** — Slide transitions with various types and durations
|
|
16
|
+
- **Animations** — Entrance, emphasis, exit, and motion path animations
|
|
17
|
+
- **Media** — Video and audio embedding
|
|
18
|
+
- **Hyperlinks** — Clickable hyperlinks on shapes and text
|
|
19
|
+
- **Headers & Footers** — Slide header/footer with date, slide number
|
|
20
|
+
- **Notes** — Speaker notes for each slide
|
|
21
|
+
- **Group Shapes** — Group multiple shapes together
|
|
22
|
+
- **DrawingML** — Shapes with fills, outlines, shadows, glow, reflection, and 3D effects
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# npm
|
|
28
|
+
npm install @office-open/pptx
|
|
29
|
+
|
|
30
|
+
# pnpm
|
|
31
|
+
pnpm add @office-open/pptx
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { Presentation, Shape, Packer, Paragraph, Run } from "@office-open/pptx";
|
|
38
|
+
import { writeFileSync } from "node:fs";
|
|
39
|
+
|
|
40
|
+
const pres = new Presentation({
|
|
41
|
+
slides: [
|
|
42
|
+
{
|
|
43
|
+
children: [
|
|
44
|
+
new Shape({
|
|
45
|
+
text: "Hello World",
|
|
46
|
+
fill: "4472C4",
|
|
47
|
+
x: 100,
|
|
48
|
+
y: 100,
|
|
49
|
+
width: 600,
|
|
50
|
+
height: 400,
|
|
51
|
+
}),
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const buffer = await Packer.toBuffer(pres);
|
|
58
|
+
writeFileSync("presentation.pptx", buffer);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Performance
|
|
62
|
+
|
|
63
|
+
Object instantiation performance vs [PptxGenJS](https://github.com/gitbrent/PptxGenJS) (higher hz is better, run on Windows 11 / Node 22):
|
|
64
|
+
|
|
65
|
+
| Scenario | @office-open/pptx | PptxGenJS | Speedup |
|
|
66
|
+
| ------------------------- | ----------------- | ---------- | --------- |
|
|
67
|
+
| Simple (2 shapes) | 4.64M ops/s | 559K ops/s | **8.3x** |
|
|
68
|
+
| Styled shapes (20 shapes) | 243K ops/s | 77K ops/s | **3.2x** |
|
|
69
|
+
| Table (10x5) | 1.86M ops/s | 27K ops/s | **69.8x** |
|
|
70
|
+
| Full featured | 188K ops/s | 19K ops/s | **9.7x** |
|
|
71
|
+
|
|
72
|
+
## Examples
|
|
73
|
+
|
|
74
|
+
Check the [demo folder](./demo) for 15 working examples covering every feature.
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
- [MIT](LICENSE) © [Demo Macro](https://imst.xyz/)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __exportAll = (all, no_symbols) => {
|
|
8
|
+
let target = {};
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
18
|
+
key = keys[i];
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
20
|
+
get: ((k) => from[k]).bind(null, key),
|
|
21
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
27
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
28
|
+
//#endregion
|
|
29
|
+
export { __reExport as n, __require as r, __exportAll as t };
|