Import
Import a JasperReports report
What brevier import reads from a JasperReports 6 .jrxml file, which elements it converts, which it names, and how the PDF export options map to Brevier.
On this page
brevier import kontoauszug.jrxml -o templates/kontoauszugThe import writes four files: kontoauszug.html, kontoauszug.css,
kontoauszug.schema.json and sample.json. A worked run with every file shown
is on the Example page.
- Each parameter
$P{bankName}becomes{{bankName}}. - The detail band becomes
{{#each rows}}, with one cell for each field$F{...}. kontoauszug.cssholds the layout of the page header, the table and the footer.kontoauszug.schema.jsonhas one property for each parameter, androwswith one property for each field.sample.jsonholds generated values that you replace with your data.- A column of a number type is right-aligned. The first column of a decimal type carries its total to the next page: see Tables.
Which files the import reads
| File | Result |
|---|---|
.jrxml in the format of JasperReports 6 |
Imported. |
.jrxml in the format of JasperReports 7 (<element kind="...">) |
Refused with an error and the line of its first element. |
.jasper (the compiled form) |
Refused. Import the .jrxml that your build compiles. |
What the import converts, and what it names
Every element has one of two results:
- Converted: it becomes template text, CSS or a formatter.
- Named: the import prints it with its line and leaves it out. The command
prints one line for each, for example
Not converted: line 41: crosstab. The last column of the table says what you do by hand.
| In the report | Result | In Brevier, or what you do |
|---|---|---|
textField with $P{x} or $F{x} |
converted | {{x}} |
pattern dd.MM.yyyy |
converted | {{x | date}} |
pattern for a number with 2 decimals and a euro sign |
converted | {{x | money}} |
.toUpperCase() |
converted | {{x | uppercase}} |
isBlankWhenNull, printWhenExpression, and a ? b : c with a field, null or comparison test |
converted | {{#if}} ... {{else}} ... {{/if}} |
$V{PAGE_NUMBER}, and with evaluationTime="Report" for the page total |
converted | counter(page), counter(pages) |
$V{...} with calculation Nothing |
converted | The expression of the variable |
$V{...} with calculation Count, Sum, Average, Lowest or Highest, where the total resets as in JasperReports |
converted | {{rows | count}}, {{rows.x | sum}} |
group on one field, with its header and footer |
converted | {{#group rows.x}} ... {{/group}} |
image with a path, $P{x} or $F{x} |
converted | <img src="..."> |
line, rectangle, frame, box borders and padding |
converted | <hr>, <div> and CSS borders |
Font, size, bold, italic, colour, alignment and style |
converted | CSS rules |
title, pageHeader, columnHeader, detail, columnFooter, pageFooter and summary |
converted | Blocks in page order |
subreport, crosstab, subDataset |
named | Nested list |
group on an expression, or a group option other than isStartNewPage, such as keepTogether |
named | Group by hand |
| In a group header or footer: an element that is not a text, or a field other than the group field | named | Group by hand |
barChart, pieChart and every other chart, componentElement such as a barcode, genericElement, image without an imageExpression or with onErrorType other than Error |
named | Image from the application |
$V{...} with another calculation, a total where it resets otherwise, or a built-in variable such as REPORT_COUNT or PAGE_COUNT |
named | Value from the application |
pattern that no formatter writes, such as a date with a time |
named | Value from the application |
A method other than .toUpperCase(), arithmetic, a minus sign and ! |
named | Value from the application |
a ? b : c with && or ||, a comparison of two fields, or in an imageExpression |
named | Value from the application |
printWhenExpression with && or ||, a comparison of two fields, or in the columnHeader |
named | Value from the application |
$R{...} |
named | Value from the application |
line or rectangle in the detail band |
named | Other ways out |
ellipse, break, elementGroup, noData, lastPageFooter, background |
named | Other ways out |
Totals
A total is converted only where it covers the same rows as in JasperReports:
resetType="Report" in the summary, resetType="Group" in the footer of its
group, and an evaluationTime of Report or Group at the end. Two
differences stay. {{rows | count}} counts every row, and JasperReports skips a
row whose value is null. A null amount stops sum with the field and the
template line, and JasperReports skips it.
PDF export options
The options of the JasperReports PDF export map as follows. Every Brevier PDF is PDF/A-3b, so the options for encryption, the PDF version, JavaScript, tags and the colour profile have no setting.
| JasperReports option | In Brevier |
|---|---|
MetadataTitle |
<title> in the template. |
MetadataAuthor, MetadataSubject, MetadataKeywords, MetadataCreator |
<meta name="author">, "description", "keywords", "generator". |
BookmarksEnabled |
The PDF has one bookmark for each heading h1 to h6. To leave one out, set bookmark-level: none in its CSS rule. |
SizePageToContent, the page offsets |
None. Set the page size and the margins in the CSS with @page. |
Encrypted, UserPassword, Permissions, PdfVersion, PdfJavaScript, Tagged |
None. |
Next: Ways out for the named elements, and Replace the call.