What this is about
Every template has an output type. It says what the template produces, and with that, which formats it can be rendered into. A format is the kind of file you get at the end, for example PDF or XLSX.
CRMS guesses no structure. A table does not come about by CRMS taking an HTML document apart. If you want an Excel file, you write a template of type TABLE.
The three output types
| DOCUMENT | TABLE | WORD | |
|---|---|---|---|
| The template writes | XHTML | the CRMS table document (a small XML) | WordprocessingML as Flat OPC (the whole package as one XML file) |
| Formats | HTML, PDF | XLSX, CSV, ODS | DOCX |
| Escaping in the template | XHTML | XML | XML |
| Own files (assets) | asset:<name> in src, href, CSS url() | – | asset:<name> in <pkg:binaryData> |
| Pictures from the request | for PDF | no | no |
| SVG with crms.svg | as vector graphics (PDF) or inline (HTML) | no | as an embedded picture |
Escaping means: special characters from the payload, such as < or &, end up in the document as text and never as markup. This happens automatically for every output type. Markup from the payload only reaches the document through crms.svg, see Pictures and SVG.
Assets are files that belong to a revision of the template, for example a logo or a font. They are approved together with the template. More in How a template is built.
DOCUMENT: HTML and PDF
The template writes XHTML. HTML returns this XHTML and makes it self-contained: every asset:<name> becomes a data: address, so the page shows its logo without CRMS and without the network.
PDF lays the XHTML out into pages with openhtmltopdf. Fonts are embedded. Text without a font of the template gets DejaVu Sans from CRMS, never a font of the server. If the <html> element has no lang, CRMS sets the document’s language.
TABLE: XLSX, CSV, ODS
The template writes the CRMS table document:
<workbook>
<sheet name="Items">
<column width="30"/>
<row header="true"><cell>Item</cell><cell>Amount</cell><cell>Due</cell></row>
<#list items as item>
<row>
<cell>${item.label}</cell>
<cell type="number" format="#,##0.00">${item.amount?c}</cell>
<cell type="date">2026-10-17</cell>
</row>
</#list>
</sheet>
</workbook>
- Cell types:
string(default),number,date(ISO),datetime(ISO with offset),boolean. formatis a number or date format for XLSX and ODS.column widthis the width in characters,row header="true"a bold header row.- A sheet name has at most 31 characters, none of
[ ] : * ? / \, and is unique in the document. - There are no formulas. Every value is prepared. In CSV, text that starts with
=,+,-,@, tab or carriage return gets a leading', so a spreadsheet does not run it as a formula. - CSV has exactly one sheet. A document with more sheets is
render-csv-single-sheet. CSV is UTF-8 without BOM, with comma and CRLF.
A broken table document (unknown element, DOCTYPE, no sheet) is render-table-invalid|<line>|<column>.
WORD: DOCX
The template writes the whole Word package as one XML file (Flat OPC). CRMS packs the DOCX file from it. CRMS fills <pkg:binaryData>asset:logo.png</pkg:binaryData> with the revision’s asset. An external relationship other than a hyperlink, for example an externally attached template or a picture from the network, is render-resource-refused. Broken XML is render-word-invalid|<line>|<column>.
Which formats an installation offers
Not every installation offers every format. Two things decide:
- Which format modules are installed. HTML is always there. PDF comes from the PDF format module, DOCX from the DOCX format module, XLSX, CSV and ODS from the table format module.
- What the configuration offers.
CODAMAI_CRMS_FORMATSlists the offered formats. Empty means: all installed ones. If the list names a format for which no module is installed, the application does not start.
In the hub you choose the formats on the CRMS module, see The CRMS module in the hub. Which formats are offered right now is reported by GET /crms/capabilities.
| Format offered and installed? | Fits the template's output type? | Result |
|---|---|---|
| no | – | 422 format-not-offered|<format> |
| yes | no | 422 format-not-for-template|<format>|<output type>, e.g. format-not-for-template|docx|document |
| yes | yes | CRMS renders |
PDF profiles
A PDF profile sets which standard a PDF meets. You choose it with pdfProfile in the request, only with format: PDF. If it is missing, the installation’s default profile applies (CODAMAI_CRMS_PDF_PROFILE, default PDF_A_3A).
| Profile | Standard | Tagged | What for |
|---|---|---|---|
NONE | plain PDF | no | quick view |
PDF_A_3A | PDF/A-3a (ISO 19005-3), with sRGB color profile | yes | long-term archiving |
PDF_UA | PDF/UA-1 (ISO 14289-1) | yes | accessibility |
PDF_A_3A_UA | PDF/A-3a and PDF/UA-1 at once | yes | archivable and accessible |
Tagged means: the PDF contains a structure of headings, paragraphs and tables that, for example, a screen reader can read out.