Formatting
image
Images can be dynamically rendered using the {{image}}
function. The image data can either be fetched from a public url with the url=…
attribute or by passing directly some base64 encoded image data (data=…
). The attribute values can be passed either as static values or from a variable in the current context.
The width and height of an image can be specified (in cm). If only one dimension is specified the other dimension is automatically calculated retaining the correct aspect ratio.
With the alt=
attribute an alternative text can be specified which gets displayed in case an image could not be rendered.
With the caption=
attribute an image caption can be defined.
{{image url="<https://my-static-image-url>" width="5" height="3" alt="" caption=""}}
{{image data=base64ImgData}}
html (Rich Text)
By using the html function, a html snippet will be converted to the docx format. This is useful for dynamically including for example richt text fields in HTML format in the docx.
{{html content=htmlContentVariable fontFamily="verdana" fontSize="12"}}
lineBreak
With the lineBreak function non html text fields containing line breaks (/n
) will be displayed as multiline output in the resulting document. Example:
{{lineBreak "multi/nline/ntext field"}}
results in:
link
With the link function native Word links can be created.
Whitespace Control
Template whitespace may be omitted from either side of any directive statement by adding a ~
character by the braces. When applied all whitespace on that side will be removed up to the first IdealDoc expression or non-whitespace character on that side.
Escaping expressions
Expression content may be escaped in one of two ways, inline escapes or raw block helpers. Inline escapes created by prefixing a block with \\.
Raw blocks are created using {{{{
braces.
Raw blocks operate in the same manner as other block helpers with the distinction of the child content is treated as a literal string.