Renduva

Renduva documentation

PowerPoint, Excel, HTML and text

Word is not the only kind of template. PowerPoint presentations, Excel workbooks, HTML pages, plain text and Markdown take the same tags (fields, formats, totals, loops and conditions; see Templates and tags), and every document type can also be delivered as OpenDocument. HTML templates and OpenDocument output from Word need the Standard tier or higher, Excel, text and Markdown templates Professional, and PowerPoint templates Enterprise; below that they answer "not licensed".

Template Made in Outputs (output.type)
docx Word pdf, docx, odt
pptx PowerPoint pdf, pptx, odp
xlsx Excel pdf, xlsx, ods
html any editor pdf, html
txt any text editor txt
md any text editor md, html, pdf
zpl a label designer or text editor zpl, png (labels)
pdf a fillable PDF form pdf (PDF forms, Enterprise)

A stored template's type comes from its file name (report.xlsx, receipt.html); a template sent with the request gives it in template.type. The APEX plug-in tells the types apart by the file's content, and text from labels by the file name (.txt, .md, .zpl). As with Word, several records are merged into one PDF; txt, md and zpl output puts the records one after another in one file; every other output takes one record.

PowerPoint templates

Type the tags straight into slides, text boxes, table cells and speaker notes. Layouts and masters are not filled.

Prepared for {{customer}} on {{date | date "DD Mon YYYY"}}
Total: {{sum items price | currency EUR}}

PowerPoint often splits typed text into several pieces (spell-check, a bold letter). Renduva joins a tag that is split this way, as long as it stays inside one paragraph; the value takes the formatting of the tag's first character. A line break in a value starts a new line in the same text box.

Sections in PowerPoint

What a section repeats or hides depends on where its tags sit:

Tags What repeats
Both in one paragraph, with other text the text between the tags
In different paragraphs of one text box those paragraphs (a paragraph holding only a tag is dropped)
In different cells of a table the table rows from the open tag to the close tag
In different shapes of one slide the whole slide

To make one slide per product, put {{#products}} at the start of the title and {{/products}} at the end of another text box on that slide:

Title:    {{#products}}{{name}}
Text box: {{description}}
          Price: {{price | currency EUR}}{{/products}}

Each copy of the slide gets its own speaker notes, filled with that item's data. A slide whose section is false or an empty list is removed, so {{#show_appendix}}...{{/show_appendix}} across two shapes shows a slide only when it is needed. {{^name}} and comparisons such as {{#status = "PAID"}} work as in Word.

Pictures and codes in PowerPoint

Insert any picture as a placeholder, then set its alt text (right-click > View Alt Text) to {{logo}}. The data's base64 PNG, JPEG or GIF replaces it, fitted inside the placeholder's frame and centered, keeping its proportions. With no value, the placeholder stays. {{qr name}}, {{code128 name}} and {{ean13 name}} draw a code from the value instead.

Colors and emphasis from data (| color, | bold, | italic), {{html}}, {{shade}} and {{chart}} are Word-only for now; a PowerPoint template using them returns an error. Format the text in the template instead. With a trial license, every slide carries a faint diagonal watermark.

Excel templates

Type the tags into cells, on any sheet.

Values in Excel

When a cell holds nothing but one field or total, with no format, the cell gets the value's own type:

Data value Cell
a number, e.g. 1250.5 a number; the cell's number format applies
true / false TRUE / FALSE
a missing value or null empty
anything else text

So give the amount column a number format in Excel (#,##0.00) and write {{amount}}: the cell stays a number, and formulas and charts over it work. A tag with a format ({{amount | currency EUR}}) or a tag with text around it (Region: {{region}}) always gives text. A filled cell takes the cell's own font and style; a tag may be typed with mixed formatting, but the filled text is not.

Repeating rows

Put {{#items}} in the first cell of a row and {{/items}} in the last, and the row is repeated for every item:

Item Qty Amount
{{#items}}{{name}} {{qty}} {{amount}}{{/items}}
Total =SUM(C5:C5)

When the tags are in different rows, the whole block of rows repeats. Conditions work the same way: {{#paid}} ... {{/paid}} keeps the rows or removes them, and {{^name}} is the reverse. A section whose tags are both in one cell repeats only that cell's text. An empty list leaves its rows once, blank, so a total over them shows 0.

Everything below the rows moves down with them, and Excel's own features follow:

  • formulas: a range over the template row grows (=SUM(C5:C5) becomes =SUM(C5:C8) for four items), references below move, and a formula in the repeated row refers to its own copy (=B5*C5 becomes =B6*C6 in the next row);
  • an Excel Table around the row grows with it, with its filter;
  • merged cells, conditional formatting, data validation, named ranges and print areas;
  • references from other sheets (Report!C5, 'My report'!C5:C8).

Excel recalculates every formula when the file is opened.

Limits in Excel

  • Pictures, charts and shapes do not move with repeated rows; put them above the rows.
  • Cell comments and manual page breaks do not move either.
  • Images, QR codes, rich text, charts and colors from data (| color, | bold) are not available in Excel templates yet; a template using them returns an error.
  • Header cells of an Excel Table must be plain text.
  • Excel has no page watermark: with a trial license the watermark is printed in the page header, so it shows when printed or converted to PDF, not on screen.

HTML templates

An HTML template is a page you write yourself, with CSS for the layout, and Renduva prints it to PDF with headless Chromium. It suits receipts, styled reports and anything easier to lay out on a web page than in Word. Tags go anywhere in the text, also in attributes:

<!doctype html>
<html>
<head>
<style>
  @page { size: A4; margin: 18mm; }
  body { font: 11pt Helvetica, Arial, sans-serif; }
  td.n { text-align: right; }
  .total { font-weight: bold; }
</style>
</head>
<body>
  <img src="data:image/png;base64,{{logo}}" alt="" height="40">
  <h1>Invoice {{invoice}}</h1>
  <p>{{customer}}<br>{{date | date "DD Mon YYYY"}}</p>
  <table>
    {{#items}}
    <tr><td>{{description}}</td><td class="n">{{amount | currency USD}}</td></tr>
    {{/items}}
    <tr class="total"><td>Total</td><td class="n">{{sum items amount | currency USD}}</td></tr>
  </table>
  {{#notes}}<p>{{notes}}</p>{{/notes}}
</body>
</html>
  • Values are text. <, > and & in data show as themselves, never as markup, and a line break in a value becomes a line break on the page.
  • A section tag alone on its line takes the line with it, so loops over table rows leave no blank lines.
  • Pictures go inline, as data: URLs (above). A page cannot load anything else: no web fonts or images from the network, no files from the server, and no scripts, which are switched off. Use fonts installed on the server, such as Liberation Sans, DejaVu, Carlito or Caladea in the container.
  • Page size and margins come from CSS @page; break pages with break-before: page. Chromium adds no header or footer of its own.
  • html output returns the filled page itself, e.g. to show in a browser or send as an email body.
  • PDF/A is not available for HTML templates; passwords and attached PDFs are (Enterprise).

Text and Markdown templates

A text template is any UTF-8 text file: fixed-width exports, files for another system, email bodies or SMS messages. Values go in exactly as they are, and a tag alone on its line takes the line with it, as in HTML:

ORDER {{order}}  {{date | date "YYYY-MM-DD"}}
{{#lines}}
{{sku}};{{quantity}};{{price | number 2}}
{{/lines}}
TOTAL;{{sum lines price | number 2}}

A Markdown template is a text file in Markdown, with GitHub's tables, so a short report or letter needs no layout work at all:

# Statement for {{customer}}

| Date | Description | Amount |
|---|---|--:|
{{#items}}
| {{date | date "DD Mon YYYY"}} | {{description}} | {{amount | currency USD}} |
{{/items}}

**Total due: {{sum items amount | currency USD}}**
  • Values stay text. Characters that would format in Markdown (*, _, #, |, [, < and a few more) get a backslash, so data never becomes bold, a link or a table cell, and a line break in a value is a line break in the document.
  • md output is the filled Markdown; html turns it into a plain, printable page; pdf prints that page with Chromium, as for HTML templates. HTML written inside the Markdown is left out, so a template cannot add scripts or styles; for full control of the look, use an HTML template.
  • A text file has no page to stamp: with a trial license the watermark is its first line.
  • PDF/A is not available for Markdown templates; passwords and attached PDFs are (Enterprise).

OpenDocument output

odt, odp and ods deliver a filled Word, PowerPoint or Excel template in the OpenDocument format, the ISO standard that LibreOffice uses and that some public administrations ask for. LibreOffice converts the filled file, so a layout that looks right in Word looks the same in LibreOffice Writer.

Requirements

In a container, the office image has both (see LibreOffice and Chromium). With the RPM, the server needs on its host:

  • LibreOffice Writer, Impress and Calc (soffice) for PDF and OpenDocument output from Word, PowerPoint and Excel templates;
  • Chromium for HTML templates and PDF from Markdown: give its path with -chrome when it is not chromium (on RHEL-family systems from EPEL it is chromium-browser). Pages still cannot reach the network or the server's files, but to switch scripts off as the container does, add the policy file {"DefaultJavaScriptSetting": 2} as /etc/chromium/policies/managed/renduva.json (for Google Chrome: /etc/opt/chrome/policies/managed/).