Jump to content
Changes to the Jaspersoft community edition download ×

Overlapping Subreports created with API

2005 IR Help

Recommended Posts

By: Trommler - trommler98

Overlapping Subreports created with API

2004-09-06 01:27



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 name="DBDATASOURCE_0_15_0SRC" class="dori.jasper.engine.JRDataSource">


<parameter name="DBDATASOURCE_0_15_1" class="dori.jasper.engine.JasperReport">


<parameter name="DBDATASOURCE_0_15_1SRC" class="dori.jasper.engine.JRDataSource">



<band height="200">




<band height="25">




<band height="50">

<image scaleImage="FillFrame" isUsingCache="false">

<reportElement key="logo" mode="Opaque" x="492" y="4" width="38" height="35"/>


<imageExpression class="java.lang.String"><![CDATA["D:\testdata\logos\kfk_logo_transperant.gif"]]></imageExpression>



<reportElement key="element-68" mode="Opaque" x="0" y="26" width="329" height="18"/>


<font fontName="Arial" size="14" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>


<text><![CDATA["Ein wunderbarer dynamischer Report"]]></text>



<reportElement key="element-69" x="0" y="47" width="530" height="1" forecolor="#ff0033"/>

<graphicElement pen="Thin"/>





<band height="100">


<reportElement key="SubReport0" positionType="Float" stretchType="RelativeToTallestObject" x="1" y="0" width="1" height="15" isPrintWhenDetailOverflows="true"/>


<subreportExpression class="dori.jasper.engine.JasperReport"><![CDATA[$P{DBDATASOURCE_0_15_0}]]></subreportExpression>



<reportElement key="SubReport1" positionType="Float" stretchType="RelativeToTallestObject" x="1" y="20" width="1" height="15" isPrintWhenDetailOverflows="true"/>


<subreportExpression class="dori.jasper.engine.JasperReport"><![CDATA[$P{DBDATASOURCE_0_15_1}]]></subreportExpression>





<band height="50">




<band height="226">







Many thanks,







By: C-Box - c-box

RE: Overlapping Subreports created with API

2004-09-06 02:10



try to put each SubReport into a dummygroup (without any expression). You will see it works! :-)








By: Trommler - trommler98

RE: Overlapping Subreports created with API

2004-09-06 06:00

Hello C-Box,


i tried ...


JRDesignGroup group = new JRDesignGroup();


JRDesignBand groupHeader = new JRDesignBand();








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 ,







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.








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,







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" >



<band height="0" isSplitAllowed="true" >




<band height="120" isSplitAllowed="true" >

<subreport isUsingCache="true">
















<printWhenExpression><![CDATA[new Boolean($P{DataContainer}.getVertriebPrintProperties().isMitUnterschriften())]]></printWhenExpression>




<subreportExpression class="dori.jasper.engine.JasperReport"><![CDATA[$P{DataContainer}.getSRUnterschrift()]]></subreportExpression>







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?!?






By: Trommler - trommler98

RE: Overlapping Subreports created with API

2004-09-07 06:41

Hi C-Box,


that really helped me.


Thanks a lot!



Link to comment
Share on other sites

  • 10 months later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...