Value Formats
You can specify the formatting for any field output by the report in the Value formats tab of the report detail view. Below is the form to add a format:
-
Name - report field name with the band prefix, for example,
Book.year
. -
Format string - field format. For number values specify the format according to the
java.text.DecimalFormat
rules, for dates -java.text.SimpleDateFormat
. -
Groovy script checkbox - allows specifying a Groovy script to format the parameter. Using the
value
alias, the current parameter value is passed to the script, which can be formatted or converted to the desired format. A Groovy script should return the new value as a string.
With the help of formats, it is possible to insert images and HTML blocks into the document.
-
In order to insert an image, specify the image URL as the field value, and the format string must be as follows:
${image:<Width>x<Height>}
, for example,${image:200x300}
.To work with the
FileRef
, use the${imageFileId:WxH}
value formatter that accepts aFileRef
instance or a URI of a file as a string. -
In order to insert an HTML block, you should return an HTML markup in the field, and select
${html}
as the format string. In the output value, you may omit top-level tags up to<body>
inclusive. If necessary, all missing top-level tags will be added automatically. All blocks should be encoded withUTF-8
. CSS and thestyle
attribute are not supported.
You can specify your own custom formats as well. To do this, type the new value in the field without opening the dropdown and press Enter. You can also choose any format from the dropdown, edit its name in the field and press Enter. Custom format will be saved in both cases.