2005 IR Help Posted August 27, 2006 Share Posted August 27, 2006 By: Trommler - trommler98 Overlapping Subreports created with API 2004-09-06 01:27 Hello! I created a master report wich contains several subreports. All reports are created dynamically using the API. The subreports should be placed each other (floating) inside the master report. But the subreports seam to overlap instead. To set the width of the subreports to "1" didn't help. Each subreport used singular is filled and displayed correctly. Here is the resulting XML Code of the master report..... <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> <jasperReport name="DynamicReport" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20"> <parameter name="DBDATASOURCE_0_15_0" class="dori.jasper.engine.JasperReport"> </parameter> <parameter name="DBDATASOURCE_0_15_0SRC" class="dori.jasper.engine.JRDataSource"> </parameter> <parameter name="DBDATASOURCE_0_15_1" class="dori.jasper.engine.JasperReport"> </parameter> <parameter name="DBDATASOURCE_0_15_1SRC" class="dori.jasper.engine.JRDataSource"> </parameter> <background> <band height="200"> </band> </background> <title> <band height="25"> </band> </title> <pageHeader> <band height="50"> <image scaleImage="FillFrame" isUsingCache="false"> <reportElement key="logo" mode="Opaque" x="492" y="4" width="38" height="35"/> <graphicElement/> <imageExpression class="java.lang.String"><![CDATA["D:\testdata\logos\kfk_logo_transperant.gif"]]></imageExpression> </image> <staticText> <reportElement key="element-68" mode="Opaque" x="0" y="26" width="329" height="18"/> <textElement> <font fontName="Arial" size="14" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> </textElement> <text><![CDATA["Ein wunderbarer dynamischer Report"]]></text> </staticText> <line> <reportElement key="element-69" x="0" y="47" width="530" height="1" forecolor="#ff0033"/> <graphicElement pen="Thin"/> </line> </band> </pageHeader> <detail> <band height="100"> <subreport> <reportElement key="SubReport0" positionType="Float" stretchType="RelativeToTallestObject" x="1" y="0" width="1" height="15" isPrintWhenDetailOverflows="true"/> <dataSourceExpression><![CDATA[$P{DBDATASOURCE_0_15_0SRC}]]></dataSourceExpression> <subreportExpression class="dori.jasper.engine.JasperReport"><![CDATA[$P{DBDATASOURCE_0_15_0}]]></subreportExpression> </subreport> <subreport> <reportElement key="SubReport1" positionType="Float" stretchType="RelativeToTallestObject" x="1" y="20" width="1" height="15" isPrintWhenDetailOverflows="true"/> <dataSourceExpression><![CDATA[$P{DBDATASOURCE_0_15_1SRC}]]></dataSourceExpression> <subreportExpression class="dori.jasper.engine.JasperReport"><![CDATA[$P{DBDATASOURCE_0_15_1}]]></subreportExpression> </subreport> </band> </detail> <pageFooter> <band height="50"> </band> </pageFooter> <summary> <band height="226"> </band> </summary> </jasperReport> ..... Many thanks, Volker By: C-Box - c-box RE: Overlapping Subreports created with API 2004-09-06 02:10 Hi, try to put each SubReport into a dummygroup (without any expression). You will see it works! :-) hth C-Box By: Trommler - trommler98 RE: Overlapping Subreports created with API 2004-09-06 06:00 Hello C-Box, i tried ... JRDesignGroup group = new JRDesignGroup(); group.setName(name+"GRP"); JRDesignBand groupHeader = new JRDesignBand(); groupHeader.setHeight(100); groupHeader.addElement(subreportDesign); group.setGroupHeader(groupHeader); jasperDesign.addGroup(group); ... But that didn't realy help. Can you give me a short example, wich shows the way to put a SubReport into a group. Thanks , Volker By: C-Box - c-box RE: Overlapping Subreports created with API 2004-09-06 06:11 I just use iReport as designer for my reports, so I don't have any example how to do that programmatically. The way you did sounds ok, but I've never done it. So I can't really help you going on. Perhaps you should remove the stretchType="RelativeToTallestObject" and use instead the "RelativeToTop" instead. Perhaps that helps already. hth C-Box By: Trommler - trommler98 RE: Overlapping Subreports created with API 2004-09-06 06:59 Hi C-Box, thanks for your help. But some tests with different stretchTypes and positionTypes didn't lead to the demanded result. Can you post or email a XML-Example for a masterReport? best regards, Volker By: C-Box - c-box RE: Overlapping Subreports created with API 2004-09-06 23:10 I can post you a group section.. it's everytime the same logic in my masterreport. (so every group looks equal) for instance here is a group that contains a subreport where some signs are printed (image and text out of a CustomDataSource): (Note that I use a parameter called "DataContainer" where all needed SubReports and it's corresponding datasources are located within - so I don't have MANY parameters for each subReport and for each datasource but therefpr ONE parameter that contains ALL needed objects) <group name="UnterschriftGroup" isStartNewColumn="false" isStartNewPage="false" isResetPageNumber="false" isReprintHeaderOnEachPage="false" minHeightToStartNewPage="0" > <groupExpression><![CDATA[null]]></groupExpression> <groupHeader> <band height="0" isSplitAllowed="true" > </band> </groupHeader> <groupFooter> <band height="120" isSplitAllowed="true" > <subreport isUsingCache="true"> <reportElement mode="Opaque" x="1" y="0" width="538" height="120" forecolor="#000000" backcolor="#FFFFFF" key="element-152" stretchType="NoStretch" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"> <printWhenExpression><![CDATA[new Boolean($P{DataContainer}.getVertriebPrintProperties().isMitUnterschriften())]]></printWhenExpression> </reportElement> <parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression> <dataSourceExpression><![CDATA[$P{DataContainer}.getClonedDSUnterschrift()]]></dataSourceExpression> <subreportExpression class="dori.jasper.engine.JasperReport"><![CDATA[$P{DataContainer}.getSRUnterschrift()]]></subreportExpression> </subreport> </band> </groupFooter> </group> the whole subreport is printed when a special condition is filled (here: $P{DataContainer}.getVertriebPrintProperties().isMitUnterschriften() ) but that is just a special case of my design. perhaps it helps you going on?!? C-Box By: Trommler - trommler98 RE: Overlapping Subreports created with API 2004-09-07 06:41 Hi C-Box, that really helped me. Thanks a lot! Volker Link to comment Share on other sites More sharing options...
dima_toxsoft Posted June 27, 2007 Share Posted June 27, 2007 Please, say how fixed! Link to comment Share on other sites More sharing options...
dima_toxsoft Posted June 27, 2007 Share Posted June 27, 2007 I found solution.If use for each SubReport an own DataSource then it work. 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