| Auszug |
|---|
|
Nuclos Jasper formatting: bold, DecimalFormat, REPORT_LOCALE, frames, address, RemoveLineWhenBlank, hyperlink, markup styled, br, LISTAGG, stretch with overflow. |
Language: Deutsch · English
Formatting recipes for JasperReports – bold, number formats, frames/addresses, hyperlinks, markup and line breaks.
| Status |
|---|
| colour | Blue |
|---|
| title | Application developer |
|---|
|
| Status |
|---|
| colour | Green |
|---|
| title | Updated: Jul 2026 |
|---|
|
| Status |
|---|
| colour | Grey |
|---|
| title | applies to Nuclos 4.2026.x |
|---|
|
The bold flag only affects the designer preview – the PDF is not changed. For real bold/italic printing choose the proper font (even though the property is shown struck through).

Choosing bold/italic via the font.
Decimals in a text field
Field content in JasperReports is defined by one Java statement. For formatted decimals:
| Codeblock |
|---|
|
new java.text.DecimalFormat("#,###,##0.00", java.text.DecimalFormatSymbols.getInstance($P{REPORT_LOCALE})).format($F{betrag}) |
Numbers inside text cannot be formatted automatically. For an English format this hack helps:
| Codeblock |
|---|
|
new java.text.DecimalFormat("#,##0.00").format($V{zwsumme}.doubleValue()).replace(",", "x").replace(".", ",").replace("x", ".") |
Via Padding and Borders of a text field a line can be shown per side. For the line to grow with the column, the fields must not have a fixed height (see Stretch with overflow).
When a field grows beyond its width, neighbouring fields shift. Fix:
- Select all text fields → right-click → Padding And Borders → Padding Top: 4px.
- Set the field height to 0px.
- Set the lower field to Position Type = Float and Position Top = 0 (like all others).
After upload all fields line up.
A frame is a container for further elements (also nested). For an address block the Title band is suitable (first page only); for envelopes leave enough page margin (approx. 50px).
Merge two fields into one address line and remove empty lines:
- In the Text Field Expression dialog concatenate the fields with
+ (string concatenation), returning null when a value is missing. - On the field set the flags RemoveLineWhenBlank, BlankWhenNull and StretchWithOverflow.
Empty lines (e.g. strstrassezusatz) are then removed automatically and the rest are pushed together.

Address block: text field expression.
Link a text field or image – either via the context menu (Hyperlink, type Reference) or directly in the JRXML:
| Codeblock |
|---|
|
<textField hyperlinkType="Reference">
<reportElement mode="Transparent" x="137" y="14" width="133" height="14"/>
<textElement>
</textElement>
<textFieldExpression class="java.lang.String">"www.nuclos.de"</textFieldExpression>
<hyperlinkReferenceExpression>"http://www.nuclos.de"</hyperlinkReferenceExpression>
</textField> |
With markup you format individual words/paragraphs inside a text field without adding a new field. Set the property markup = styled and use <style> tags:
| Codeblock |
|---|
|
<style isBold='true' pdfFontName='Helvetica-Bold' >Das ist ein dicker Text </style><style isBold='true' pdfFontName='Helvetica-Bold' size='20'>20 Pixel groß </style><style isItalic='true' isUnderline='true' forecolor='green'> Grüner Text unterstzrichen und schief </style><style isBold='true' pdfFontName='Helvetica-Bold' size='12'>& hallo ich bin ein Sonderzeichen</style> |
| Warnung |
|---|
|
Markup fails if the text contains a &. Replace it beforehand with the entity: attribute.replaceAll("&", "&"). Replace other special characters via their UTF-8 sequence if needed. |
A <br/> in the text produces a line break (field still markup = styled). Example: concatenate a result set in Oracle via LISTAGG() with <br/>:
| Codeblock |
|---|
|
SELECT listagg(T2x."STRBEZEICHNUNG",'<br/>')
within group (order by T2x."STRBEZEICHNUNG") "strtext"
FROM
Tabelle T1x
WHERE
(
T1x."Tabelle T1x" = Parameter
)) "strtext", |
Min height to start new page
This property specifies the space already used by other components (not the height of the current element) from which a new page break starts.
Related pages