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
@@ -11,40 +11,43 @@ Thanks to all contributors! You are always welcome to share code, tipps and idea
11
11
If you require commercial support for complex .pptx automation, you can explore [ensemblio.com](https://ensemblio.com). Ensemblio is a web application that leverages `pptx-automizer` and `automizer-data` to provide an accessible and convenient solution for automating .pptx files. Engaging with Ensemblio is likely to enhance and further develop this library.
12
12
13
13
## Table of contents
14
+
14
15
<!-- TOC -->
15
-
*[Requirements and Limitations](#requirements-and-limitations)
16
-
*[Shape Types](#shape-types)
17
-
*[Chart Types](#chart-types)
18
-
*[Animations](#animations)
19
-
*[Slide Masters and -Layouts](#slide-masters-and--layouts)
20
-
*[Direct Manipulation of Elements](#direct-manipulation-of-elements)
21
-
*[PowerPoint Version](#powerpoint-version)
22
-
*[Installation](#installation)
23
-
*[As a Cloned Repository](#as-a-cloned-repository)
24
-
*[As a Package](#as-a-package)
25
-
*[Usage](#usage)
26
-
*[Basic Example](#basic-example)
27
-
*[How to Select Slides Shapes](#how-to-select-slides-shapes)
28
-
*[Select slide by number and shape by name](#select-slide-by-number-and-shape-by-name)
29
-
*[Select slides by creationId](#select-slides-by-creationid)
30
-
*[Find and Modify Shapes](#find-and-modify-shapes)
@@ -853,6 +857,55 @@ const automizer = new Automizer({
853
857
});
854
858
```
855
859
860
+
## Create a new modifier
861
+
862
+
If the built-in modifiers of `pptx-automizer` are not sufficient to your task, you can access the target xml elements with [xmldom](https://github.com/xmldom/xmldom). A modifier is a wrapper for such an operation.
863
+
864
+
Let's first take a look at a (simplified) existing modifier: `ModifyTextHelper.content('This is my text')`.
865
+
866
+
```ts
867
+
// "setTextContent" is a function that returns a function.
868
+
// A "label" argument needs to be passed to "setTextContent".
// It is possible to output the xml to console at any time.
885
+
// XmlHelper.dump(element);
886
+
};
887
+
};
888
+
```
889
+
This function will construct an anonymous callback function on setup, while the callback function itself will be executed on runtime, when it's up to the target element on a slide.
890
+
891
+
You can use the modifier e.g. on adding an element:
// Notice: don't call XmlHelper.dump, just pass it
899
+
XmlHelper.dump,
900
+
// 2. Apply modifier from the example above:
901
+
setTextContent('New text'),
902
+
XmlHelper.dump,
903
+
]);
904
+
});
905
+
```
906
+
907
+
We can wrap any xml modification by such a modifier. If you have a working example and you think it will be useful to others, you are very welcome to fork this repo and send a pull request or simply [post it](https://github.com/singerla/pptx-automizer/issues/new).
908
+
856
909
## More examples
857
910
858
911
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.:
@@ -864,6 +917,20 @@ Take a look into [**tests**-directory](https://github.com/singerla/pptx-automize
864
917
-[Update chart plot area coordinates](https://github.com/singerla/pptx-automizer/blob/main/__tests__/modify-chart-plot-area.test.ts)
If you encounter problems when opening a `.pptx`-file modified by this library, you might worry about PowerPoint not giving any details about the error. It can be hard to find the cause, but there are some things you can check:
923
+
924
+
-**Broken relation**: There are still unsupported shape types and `pptx-automizer` wil not copy required relations of those. You can inflate `.pptx`-output and check `ppt/slides/_rels/slide[#].xml.rels`-files to find possible missing files.
925
+
-**Unsupported media**: You can also take a look at the `ppt/media`-directory of an inflated `.pptx`-file. If you discover any unusual file formats, remove or replace the files by one of the [known types](https://github.com/singerla/pptx-automizer/blob/main/src/enums/content-type-map.ts).
926
+
-**Broken animation**: Pay attention to modified/removed shapes which are part of an animation. In case of doubt, (temporarily) remove all animations from your template. (see [#78](https://github.com/singerla/pptx-automizer/issues/78))
927
+
-**Proprietary/Binary contents** (e.g. ThinkCell): Walk through all slides, slideMasters and slideLayouts and seek for hidden Objects. Hit `ALT+F10` to toggle the sidebar.
928
+
-**Chart styles not working**: If you try to change e.g. color or size of a chart data label, and it doesn't work as expected, try to remove all data labels and activate them again. If this does not help, try to give the first data label of a series a slightly different style (this creates a single data point).
929
+
-**Replace Text not working**: Cut out your e.g. {CustomerName} tag from textbox to clipboard, paste it into a plaintext editor to remove all (visible and invisible) formatting. Copy & paste {CustomerName} back to the textbox. (see [#82](https://github.com/singerla/pptx-automizer/issues/82) and [#73](https://github.com/singerla/pptx-automizer/issues/73))
930
+
931
+
932
+
If none of these could help, please don't hesitate to [talk about it](https://github.com/singerla/pptx-automizer/issues/new).
0 commit comments