ktrinad Posted August 20, 2006 Share Posted August 20, 2006 By: Ulf Heyder - olpp border / frame around the whole page 2004-09-03 01:30I have a mainreport and two subreports, with serveral groups. Is it possible to put a border /frame around the whole page, not inside each band of a group or the detail section? I tried to put vertical lines in each band, but because of the dynamic size of the supreports the lines are too short to fit the whole page. Here is the file: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> <!-- Einheit aller Ma e im Report ist 1pt = 1/72 inch. 1 inch = 2.54 cm. -> 1cm ~= 28.35pt bzw. 1pt ~= 0.353mm 595x842 = DIN A4. columnWidth<=pageWidth-leftMargin-rightMargin --> <jasperReport name="bestandUebersicht_nw_LK_unverschl" pageWidth="595" pageHeight="842" columnWidth="525" leftMargin="40" rightMargin="30" topMargin="30" bottomMargin="30"> <!-- vordefinierte Fonts --> <reportFont name="Arial_Normal" isDefault="true" fontName="Arial" size="10" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> <reportFont name="Arial_Bold" isDefault="false" fontName="Arial" size="8" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/> <reportFont name="Arial_Italic" isDefault="false" fontName="Arial" size="8" isItalic="true" isBold="true" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/> <!-- Parameter, die in der ParameterMap mit bergeben wurden (bei uns i.d.R. der Pfad der Reporte und die subReportMaps) --> <parameter name="JasperReportPath" class="java.lang.String"/> <parameter name="subMapFlst" class="java.util.Map"/> <parameter name="subMapFlstSize" class="java.lang.Integer"/> <parameter name="subMapEig" class="java.util.Map"/> <parameter name="subMapEigSize" class="java.lang.Integer"/> <parameter name="subMapLage" class="java.util.Map"/> <parameter name="subMapLageSize" class="java.lang.Integer"/> <parameter name="subMapAbs" class="java.util.Map"/> <parameter name="subMapAbsSize" class="java.lang.Integer"/> <!-- Datenfelder f r diesen Report --> <field name="BU21007_OID_UID" class="java.lang.String"/> <field name="BU21007_BBK_BBZ" class="java.lang.String"/> <field name="BU21007_BBK_BBN" class="java.lang.String"/> <field name="BU21007_LE1" class="java.lang.Integer"/> <field name="BU21007_LE2" class="java.lang.Integer"/> <field name="BU21007_Amt_Bez" class="java.lang.String"/> <field name="BU21007_GBBZ_Bez" class="java.lang.String"/> <field name="KatamtBez" class="java.lang.String"/> <field name="SummeFla" class="java.lang.String"/> <field name="BU21008_LEBAR" class="java.lang.String"/> <!-- Diese Variable erzeugt zu Beginn und bei jedem Reset durch die "SubLageGroup" eine neue JasperMapDataSource aus den Subreportdaten, damit diese f r den n chsten ParentKey wieder von Beginn an durchlaufen wird --> <variable name="subMapFlstDataSource" class="ibr.jasper.JasperMapDataSource" resetType="Group" resetGroup="SubFlstGroup" calculation="System"> <variableExpression> new ibr.jasper.JasperMapDataSource($P{subMapFlst},$P{subMapFlstSize}.intValue()) </variableExpression> <initialValueExpression>new ibr.jasper.JasperMapDataSource($P{subMapFlst},$P{subMapFlstSize}.intValue())</initialValueExpression> </variable> <variable name="subMapEigDataSource" class="ibr.jasper.JasperMapDataSource" resetType="Group" resetGroup="SubEigGroup" calculation="System"> <variableExpression> new ibr.jasper.JasperMapDataSource($P{subMapEig},$P{subMapEigSize}.intValue()) </variableExpression> <initialValueExpression>new ibr.jasper.JasperMapDataSource($P{subMapEig},$P{subMapEigSize}.intValue())</initialValueExpression> </variable> <!-- Die "SubXXGroup" gruppiert alle Daten nach der FlstOID. Groups k nnen Reset-Ereignisse f r Variablen ausl sen, wenn die groupexpression sich ndert. --> <group name="SubEigGroup"> <groupExpression> $F{BU21007_OID_UID} </groupExpression> </group> <group name="SubFlstGroup"> <groupExpression> $F{BU21007_OID_UID} </groupExpression> </group> <group name="Gbst1"> <groupExpression> $F{BU21007_OID_UID} </groupExpression> <groupHeader> <band height="120"> <elementGroup> <line> <reportElement x="0" y="0" width="0" height="120" isPrintWhenDetailOverflows="true"/> <graphicElement stretchType="RelativeToBandHeight" pen="1Point"/> </line> <line> <reportElement x="525" y="0" width="0" height="120" isPrintWhenDetailOverflows="true"/> <graphicElement stretchType="RelativeToBandHeight" pen="1Point"/> </line> </elementGroup> <textField> <reportElement x="310" y="0" width="160" height="12"/> <textElement textAlignment="Right"> </textElement> <textFieldExpression class="java.lang.String"> "Datum " + (new SimpleDateFormat("d. MMMM yyyy")).format(new Date()).toString() </textFieldExpression> </textField> <textField evaluationTime="Now" isStretchWithOverflow="true"> <reportElement x="470" y="0" width="50" height="12"/> <textElement textAlignment="Right"> </textElement> <textFieldExpression class="java.lang.String"> "- Seite "+$V{PAGE_NUMBER} </textFieldExpression> </textField> <textField isBlankWhenNull="true"> <reportElement x="10" y="24" width="300" height="12" isRemoveLineWhenBlank="true"/> <textFieldExpression class="java.lang.String"> "Eingetragen beim Amtsgericht " + $F{BU21007_Amt_Bez} </textFieldExpression> </textField> <textField isBlankWhenNull="true"> <reportElement x="67" y="36" width="300" height="12" isRemoveLineWhenBlank="true"/> <textFieldExpression class="java.lang.String"> "im Grundbuch von " + ($F{BU21007_GBBZ_Bez} != null ? $F{BU21007_GBBZ_Bez} : "") </textFieldExpression> </textField> <textField isBlankWhenNull="true"> <reportElement x="67" y="48" width="100" height="12" isRemoveLineWhenBlank="true"/> <textFieldExpression class="java.lang.String"> "Grundbuchblatt " + $F{BU21007_BBK_BBN} </textFieldExpression> </textField> <!--textField isBlankWhenNull="true"> <reportElement x="175" y="48" width="200" height="24" isRemoveLineWhenBlank="true"/> <textFieldExpression class="java.lang.String"> "Bestandsverzeichnisnummer " + $F{BU21008_LELNR} </textFieldExpression> </textField--> <subreport isUsingCache="true"> <!-- Koordinaten und Gr e des subReport-Blockes so w hlen, als k me genau eine Zeile als Ergebnis zur ck. isRemoveLineWhenBlank -> Leere Zeilen entfernen --> <reportElement x="5" y="72" width="500" height="36" isRemoveLineWhenBlank="true"/> <!-- Der aktuell verarbeitete ParentKey wird dem Subreport als Parameter mitgegeben. --> <subreportParameter name="ParentKey"> <subreportParameterExpression> $F{BU21007_OID_UID} </subreportParameterExpression> </subreportParameter> <!-- Der Repotrpfad mu auch weitergereicht werden, damit der Subreport Bilder oder SubSubReporte findet --> <subreportParameter name="JasperReportPath"> <subreportParameterExpression> $P{JasperReportPath} </subreportParameterExpression> </subreportParameter> <!-- Die subMapLageDataSource, die dem Hauptreport als Parameter mitgegeben wurde, wird hier als SubReportDatenquelle festgelegt. --> <dataSourceExpression> $V{subMapEigDataSource} </dataSourceExpression> <!-- Der Pfad und Name des Subreport wird gesetzt --> <subreportExpression class="java.lang.String"> $P{JasperReportPath}+"bestand_nw_subeig_LK.jasper" </subreportExpression> </subreport> </band> </groupHeader> </group> <group name="Gbst2"> <groupExpression> $F{BU21007_OID_UID} </groupExpression> <groupHeader> <band height="84"> <elementGroup> <line> <reportElement x="0" y="0" width="0" height="84" positionType="Float" isPrintWhenDetailOverflows="true"/> <graphicElement stretchType="RelativeToBandHeight" pen="1Point"/> </line> <line> <reportElement x="525" y="0" width="0" height="84" positionType="Float" isPrintWhenDetailOverflows="true"/> <graphicElement stretchType="RelativeToBandHeight" pen="1Point"/> </line> </elementGroup> <!-- hier wird der Subreport Flurst ck eingef gt --> <subreport isUsingCache="true"> <!-- Koordinaten und Gr e des subReport-Blockes so w hlen, als k me genau eine Zeile als Ergebnis zur ck. isRemoveLineWhenBlank -> Leere Zeilen entfernen --> <reportElement x="5" y="0" width="400" height="84" isRemoveLineWhenBlank="true"/> <!-- Der aktuell verarbeitete ParentKey wird dem Subreport als Parameter mitgegeben. --> <subreportParameter name="ParentKey"> <subreportParameterExpression> $F{BU21007_OID_UID} </subreportParameterExpression> </subreportParameter> <!-- Die SubMapLage wird dem Subreport als Parameter mitgegeben. --> <subreportParameter name="subMapLage"> <subreportParameterExpression> $P{subMapLage} </subreportParameterExpression> </subreportParameter> <!-- Die SubMapLageSize wird dem Subreport als Parameter mitgegeben. --> <subreportParameter name="subMapLageSize"> <subreportParameterExpression> $P{subMapLageSize} </subreportParameterExpression> </subreportParameter> <!-- Die SubMapAbs wird dem Subreport als Parameter mitgegeben. --> <subreportParameter name="subMapAbs"> <subreportParameterExpression> $P{subMapAbs} </subreportParameterExpression> </subreportParameter> <!-- Die SubMapAbsSize wird dem Subreport als Parameter mitgegeben. --> <subreportParameter name="subMapAbsSize"> <subreportParameterExpression> $P{subMapAbsSize} </subreportParameterExpression> </subreportParameter> <!-- Der Repotrpfad mu auch weitergereicht werden, damit der Subreport Bilder oder SubSubReporte findet --> <subreportParameter name="JasperReportPath"> <subreportParameterExpression> $P{JasperReportPath} </subreportParameterExpression> </subreportParameter> <!-- Die subMapLageDataSource, die dem Hauptreport als Parameter mitgegeben wurde, wird hier als SubReportDatenquelle festgelegt. --> <dataSourceExpression> $V{subMapFlstDataSource} </dataSourceExpression> <!-- Der Pfad und Name des Subreport wird gesetzt --> <subreportExpression class="java.lang.String"> $P{JasperReportPath}+"bestandUebersicht_nw_subflst_LK_unverschl.jasper" </subreportExpression> </subreport> </band> </groupHeader> </group> <!-- Seitenkopf --> <pageHeader> <band height="53"> <line> <reportElement x="0" y="0" width="0" height="53" positionType="Float" isPrintWhenDetailOverflows="true"/> <graphicElement stretchType="RelativeToBandHeight" pen="1Point"/> </line> <line> <reportElement x="525" y="0" width="0" height="53" positionType="Float" isPrintWhenDetailOverflows="true"/> <graphicElement stretchType="RelativeToBandHeight" pen="1Point"/> </line> <line> <reportElement x="0" y="0" width="525" height="0"/> <graphicElement stretchType="NoStretch" pen="1Point"/> </line> <staticText> <reportElement x="0" y="3" width="272" height="14"/> <textElement textAlignment="Center"> </textElement> <text>Text</text> </staticText> <staticText> <reportElement x="0" y="17" width="272" height="10"/> <textElement textAlignment="Center"> <font reportFont="Arial_Normal" size="8"/> </textElement> <text>- Text -</text> </staticText> <line> <reportElement x="273" y="0" width="1" height="51"/> <graphicElement stretchType="NoStretch" pen="1Point"/> </line> <staticText> <reportElement x="300" y="3" width="70" height="12"/> <textElement textAlignment="Left"> </textElement> <text>Testamt</text> </staticText> <textField isStretchWithOverflow="true"> <reportElement x="300" y="15" width="220" height="12"/> <textElement textAlignment="Left"> </textElement> <textFieldExpression class="java.lang.String"> $F{KatamtBez} </textFieldExpression> </textField> <staticText> <reportElement x="0" y="37" width="272" height="14"/> <textElement textAlignment="Center"> <font reportFont="Arial_Normal" size="12"/> </textElement> <text> bersicht</text> </staticText> <line> <reportElement x="1" y="52" width="524" height="0"/> <graphicElement stretchType="NoStretch" pen="1Point"/> </line> </band> </pageHeader> <!-- Hauptdatenblock --> <detail> <band height="460"> <elementGroup> <line> <reportElement x="0" y="0" width="0" height="460" positionType="Float" isPrintWhenDetailOverflows="true"/> <graphicElement stretchType="RelativeToBandHeight" pen="1Point"/> </line> <line> <reportElement x="525" y="0" width="0" height="460" positionType="Float" isPrintWhenDetailOverflows="true"/> <graphicElement stretchType="RelativeToBandHeight" pen="1Point"/> </line> </elementGroup> <textField> <reportElement x="25" y="0" width="100" height="12"/> <textElement textAlignment="Left"> </textElement> <textFieldExpression class="java.lang.String"> "Bestand insgesamt:" </textFieldExpression> </textField> <textField> <reportElement x="245" y="0" width="30" height="12"/> <textElement textAlignment="Right"> </textElement> <textFieldExpression class="java.lang.String"> $P{subMapFlstSize}.toString() </textFieldExpression> </textField> <textField> <reportElement x="285" y="0" width="100" height="12"/> <textElement textAlignment="Left"> </textElement> <textFieldExpression class="java.lang.String"> $P{subMapFlstSize}.intValue() > 1 ? "Flurst cke" : "Flurst ck" </textFieldExpression> </textField> <textField> <reportElement x="245" y="12" width="30" height="12"/> <textElement textAlignment="Right"> </textElement> <textFieldExpression class="java.lang.String"> $F{SummeFla} </textFieldExpression> </textField> <textField> <reportElement x="285" y="12" width="230" height="12"/> <textElement textAlignment="Left"> </textElement> <textFieldExpression class="java.lang.String"> "m als " + $F{BU21008_LEBAR} </textFieldExpression> </textField> </band> </detail> <!-- Seitenfu --> <pageFooter> <band height="40"> <line> <reportElement x="0" y="0" width="0" height="40"/> <graphicElement stretchType="NoStretch" pen="1Point"/> </line> <line> <reportElement x="525" y="0" width="0" height="40"/> <graphicElement stretchType="NoStretch" pen="1Point"/> </line> <line> <reportElement x="0" y="0" width="400" height="0"/> <graphicElement stretchType="NoStretch" pen="1Point"/> </line> <line> <reportElement x="400" y="0" width="0" height="40"/> <graphicElement stretchType="NoStretch" pen="1Point"/> </line> <textField isStretchWithOverflow="true"> <reportElement x="0" y="4" width="400" height="12"/> <textElement textAlignment="Center"> <font reportFont="Arial_Normal" size="8"/> </textElement> <textFieldExpression class="java.lang.String"> "Text" </textFieldExpression> </textField> <textField isStretchWithOverflow="true"> <reportElement x="0" y="16" width="400" height="12"/> <textElement textAlignment="Center"> <font reportFont="Arial_Normal" size="8"/> </textElement> <textFieldExpression class="java.lang.String"> "Text" </textFieldExpression> </textField> <textField isStretchWithOverflow="true"> <reportElement x="0" y="28" width="400" height="12"/> <textElement textAlignment="Center"> <font reportFont="Arial_Normal" size="8"/> </textElement> <textFieldExpression class="java.lang.String"> "Text" </textFieldExpression> </textField> <line> <reportElement x="0" y="40" width="525" height="0"/> <graphicElement stretchType="NoStretch" pen="1Point"/> </line> </band> </pageFooter> </jasperReport> By: Vinod Kumar Singh - vinodsingh RE: border / frame around the whole page 2004-09-03 21:40Use background band By: Ulf Heyder - olpp RE: border / frame around the whole page 2004-09-06 00:58I can't find any help about 'background band'. In which element can I use a background band? By: Vinod Kumar Singh - vinodsingh RE: border / frame around the whole page 2004-09-06 04:08<background> <band height="611" isSplitAllowed="true" > <rectangle radius="0" > <reportElement mode="Transparent" x="0" y="0" width="740" height="611" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <graphicElement stretchType="NoStretch" pen="1Point" fill="Solid" /> </rectangle> </band> </background> Link to comment Share on other sites More sharing options...
saket101083 Posted July 16, 2008 Share Posted July 16, 2008 Where should we put the background section? I want the whole page(including the title/summary/footer, etc) to be within the border. Link to comment Share on other sites More sharing options...
szaboaz Posted July 16, 2008 Share Posted July 16, 2008 What do you mean by "where". Of course, to the place where other band elements are. Here's an average-ish jrxml (with no actual content): Code:<?xml version="1.0" encoding="UTF-8" ?><!-- Created with iReport - A designer for JasperReports --><!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"><jasperReport name="Untitled_report_1" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="595" pageHeight="842" columnWidth="535" columnSpacing="0" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20" whenNoDataType="NoPages" isTitleNewPage="false" isSummaryNewPage="false"> <property name="ireport.scriptlethandling" value="2" /> <property name="ireport.encoding" value="UTF-8" /> <import value="java.util.*" /> <import value="net.sf.jasperreports.engine.*" /> <import value="net.sf.jasperreports.engine.data.*" /> <background> <band height="0" isSplitAllowed="true" > </band> </background> <title> <band height="50" isSplitAllowed="true" > </band> </title> <pageHeader> <band height="50" isSplitAllowed="true" > </band> </pageHeader> <columnHeader> <band height="30" isSplitAllowed="true" > </band> </columnHeader> <detail> <band height="100" isSplitAllowed="true" > </band> </detail> <columnFooter> <band height="30" isSplitAllowed="true" > </band> </columnFooter> <pageFooter> <band height="50" isSplitAllowed="true" > </band> </pageFooter> <lastPageFooter> <band height="50" isSplitAllowed="true" > </band> </lastPageFooter> <summary> <band height="50" isSplitAllowed="true" > </band> </summary></jasperReport> As you can see, there's a <background></background> element there. So according to the advices in the previous message, you have to set the background's height to the maximum available value (which is the page size minus top and bottom margins). Then you put your border (that is a rectangle element) into the band (with the appropriate size - in this case it is also the maximum available, I guess). Is it clearer? Arpad Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now