This module exposes a tag to include html inside a Pptx document. The HTML is converted to Native Open XML by the module. This allows you to add a formatted field entered by the user
This module is available as part of the docxtemplater ENTREPRISE plan.
This module allows to add some HTML to a powerpoint document (pptx).
It is not possible to mix different types of HTML elements in a single shape.
In the PPTX format, everything is inside a "box" which is techically called a "shape" (XML tag <p:sp>
) , and a box can contain either :
The box is statically positioned (x and y coordinate).
In a pptx template, the tag {~~html} will be inside one particular box, so it can't generate multiple boxes (or they would overlap, which would be unreadable).
This is why one HTML tag : {~~html} will alway render one box, so for example the following HTML data would throw an error because it mixes tables and paragraphs :
<p>Hello</p>
<table>
<tr>
<td><p>Hello</p></td>
</tr>
</table>
<p>Hello</p>
The HTML module currently supports:
<p>
<h1-h6>
with some default sizes for each level, the sizes of the titles can be customized<span>
<br>
<ul>
, <ol>
and <li>
for ordered and unordered lists<strong>
and <em>
<a href="URL">Linktext</a>
It is possible to set options to the htmlPptxModule in the constructor of the module.
Description of the options :
<span>
;To ignore all unknown tags:
const module = new HTMLModule({
ignoreUnknownTags: true,
});
Better handle override of style. Includes a quite big rewrite.
For example, it is now possible to override the color of some text in a given run without producing a corruption and without losing all other formatting on that block of text.
Disallow to pass something other than a string to the stylesheet option (because this option only allows to pass a given global stylesheet)
Bugfix when using together with slides module, it would result in the following error :
MultiError :
TypeError: Cannot read property 'length' of undefined
at HtmlModule.hasListInSlideMaster (docxtemplater-html-pptx-module/es6/index.js:289:19)
Now, loops created with the slides module can contain html-pptx tags
Fix issue with css module :
Module not found: Error: Can't resolve 'fs' in '[...]\node_modules\css\lib\stringify'
Now, the module requires only the part that it uses, which removes this error.
Bugfix to ignore <br>
at the end of block elements.
Bugfix to render space in inline HTML tag when using : <b>Foo</b> <i>Bar</i>
Bugfix corruption when using ul and li, sometimes, it would return a float value for spcPts
Add way to specify spacing between bullet and text, and indent of bullet with :
ul li {
-dxt-bullet-indent: 1in;
-dxt-bullet-spacing: 1in;
}
Better handle margin-top/margin-bottom for li tags
Declare supportedFileTypes, which allows to use this module with the new docxtemplater constructor which was introduced in docxtemplater 3.17.
Add support for <u>
, <sub>
and <sup>
tag and for style : text-decoration: underlined
.
Initial release
Edgar Hipp