You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -9,10 +9,19 @@ This project comes along with [automizer-data](https://github.com/singerla/autom
9
9
This generator can only be used on the server-side and requires a [Node.js](https://nodejs.org/en/download/package-manager/) environment.
10
10
11
11
## Limitations
12
+
### Shape types
12
13
Please note that this project is *work in progress*. At the moment, you might encounter difficulties for special shape types that require further relations (e.g. links will not work properly). Although, most shape types are already supported, such as connection shapes, tables or charts. You are welcome to [report any issue](https://github.com/singerla/pptx-automizer/issues/new).
13
14
15
+
### Chart types
16
+
Extended chart types, like waterfall or map charts, are not supported right now.
17
+
18
+
### PowerPoint Version
14
19
All testing focuses on PowerPoint 2019 pptx file format.
15
20
21
+
### Slide Masters and -Layouts
22
+
It is currently not supported to import slide masters or slide layouts into the root presentation. You can append any slide in any order, but you need to assure all pptx files to have the same set of master slides. Imported slide masters will be matched by number, e.g. if your imported slide uses master #3, your root presentation also needs to have at least three master slides.
23
+
24
+
16
25
## Install
17
26
There are basically two ways to use *pptx-automizer*.
18
27
@@ -40,15 +49,9 @@ $ npm install pptx-automizer
40
49
```
41
50
in the root folder of your project. This will download and install the most recent version into your existing project.
42
51
43
-
## Example
44
-
```js
45
-
importAutomizer, { modify } from"pptx-automizer"
46
-
47
-
// If you want to track the steps of creation process,
48
-
// you can use a custom callback:
49
-
constmyStatusTracker= (status:StatusTracker) => {
50
-
console.log(status.info+' ('+status.share+'%)');
51
-
};
52
+
## General Example
53
+
```ts
54
+
importAutomizerfrom"pptx-automizer"
52
55
53
56
// First, let's set some preferences!
54
57
const automizer =newAutomizer({
@@ -69,12 +72,14 @@ const automizer = new Automizer({
69
72
// truncate root presentation and start with zero slides
70
73
removeExistingSlides: true,
71
74
72
-
// use a callback function to track pptx generation process
73
-
statusTracker: myStatusTracker,
75
+
// use a callback function to track pptx generation process.
76
+
//statusTracker: myStatusTracker,
74
77
})
75
78
76
79
// Now we can start and load a pptx template.
77
-
// Each addSlide will append to any existing slide in RootTemplate.pptx.
80
+
// With removeExistingSlides set to 'false', each addSlide will append to
81
+
// any existing slide in RootTemplate.pptx. Otherwise, we are going to start
82
+
// with a truncated root template.
78
83
let pres =automizer.loadRoot(`RootTemplate.pptx`)
79
84
// We want to make some more files available and give them a handy label.
80
85
.load(`SlideWithShapes.pptx`, 'shapes')
@@ -89,9 +94,33 @@ pres.addSlide('graph', 1)
89
94
.addSlide('shapes', 1)
90
95
.addSlide(`SlideWithImages.pptx`, 2)
91
96
92
-
// You can also select and import a single element from a template slide.
93
-
// The desired shape will be identified by its name from slide-xml's
You can also select and import a single element from a template slide. The desired shape will be identified by its name from slide-xml's `p:cNvPr`-element.
All data and styles can be modified. Please notice: If your template has more data than your data object, automizer will remove these nodes. The other way round, new nodes will be created from the existing ones in case you provide more data.
There are three ways to arrange slides in an output presentation.
186
+
187
+
1. By default, all slides will be appended to the existing slides in your root template. The order of `addSlide`-calls will define slide sortation in output presentation.
188
+
189
+
2. You can alternatively remove all existing slides by setting the `removeExistingSlides` flag to true. The first slide added with `addSlide` will be first slide in the output presentation. If you want to insert slides from root template, you need to load it a second time.
190
+
191
+
```ts
192
+
importAutomizerfrom"pptx-automizer"
193
+
194
+
const automizer =newAutomizer({
195
+
templateDir: `my/pptx/templates`,
196
+
outputDir: `my/pptx/output`,
197
+
198
+
// truncate root presentation and start with zero slides
199
+
removeExistingSlides: true,
200
+
})
201
+
202
+
203
+
let pres =automizer.loadRoot(`RootTemplate.pptx`)
204
+
// We load this twice to make it slide reordeing available
205
+
.load(`RootTemplate.pptx`, 'root')
206
+
.load(`SlideWithShapes.pptx`, 'shapes')
207
+
.load(`SlideWithGraph.pptx`, 'graph')
208
+
209
+
pres.addSlide('root', 1) // First slide will be taken from root
210
+
.addSlide('graph', 1)
211
+
.addSlide('shapes', 1)
212
+
.addSlide('root', 3) // Third slide from root we be appended
213
+
.addSlide('root', 2) // Second and third slide will switch position
Take a look into [__tests__-directory](https://github.com/singerla/pptx-automizer/blob/main/__tests__) to see a lot of examples for several use cases, e.g.:
267
+
*[Style chart series or datapoints](https://github.com/singerla/pptx-automizer/blob/main/__tests__/modify-existing-chart-styled.test.ts)
268
+
*[Use tags inside text to replace contents](https://github.com/singerla/pptx-automizer/blob/main/__tests__/replace-tagged-text.test.ts)
269
+
*[Modify vertical line charts](https://github.com/singerla/pptx-automizer/blob/main/__tests__/modify-chart-vertical-lines.test.ts)
270
+
*[Set table cell and border styles](https://github.com/singerla/pptx-automizer/blob/main/__tests__/modify-existing-table.test.ts)
0 commit comments