I report JasperReports sono dei file in formato xml, con estensione .jrxml. Nell'articolo precedente abbiamo usato il wizard per generare rapidamente il nostro report, adesso incominceremo ad analizzare la struttura del report.
Analizziamo la struttura base del report, che otteniamo con ireport quando scegliamo di generare un report vuoto.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD JasperReport//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="report name" pageWidth="595" pageHeight="842"
columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<background> <band/> </background>
<title> <band height="79"/> </title>
<pageHeader> <band height="35"/> </pageHeader>
<columnHeader> <band height="61"/> </columnHeader>
<detail> <band height="125"/> </detail>
<columnFooter> <band height="45"/> </columnFooter>
<pageFooter> <band height="54"/> </pageFooter>
<summary> <band height="42"/> </summary>
</jasperReport>
Analizziamo in dettaglio gli elementi che compongono la struttura del report:
L'utente può aggiungere elementi ad ogni sezione per costruire l'aspetto grafico del report.
Inoltre è possibile aggiungere i seguenti elementi per gestire il report: