Jump to content
We've recently updated our Privacy Statement, available here ×

Subreport Overlap each other


inditrozen

Recommended Posts

Hi All,

 

I have a question regarding the subreports. Requirement is to have 5 subreports one below another.

 

If each subreport contains only one row then it shows correctly but for more than one rows in each report (area for one report increases)they started overlapping each other.

 

As there are more rows in the first subreport second subreport should start once first is finished but it does start at the same pixel positions as it started with single row.

 

Any idea how can I ask the subreport to start when last subreport is finshed showing its rows.

 

Thanks in advance

Link to comment
Share on other sites

  • Replies 13
  • Created
  • Last Reply

Top Posters In This Topic

  • 7 months later...

Hi,

I encountered the same problem (overlapping subreport tables), but turning on the "positionType = float" didn't work.  I have copied the relevant code from my JRXML, and attached an example of the PDF that it's getting generated with the overlapping tables.

Are there other flags I should be checking to prevent the overlap? or am I making some obvious mistake?

FYI: I'm using JR version 3.0.0

Thanks in advance,

 

Ricardo Ulate

Code:
...	<detail>		<band height="2">			<subreport>				<reportElement positionType="Float" x="0" y="0" width="0" height="0"/>				...			</subreport>			<subreport>				<reportElement positionType="Float" x="0" y="1" width="0" height="0"/>				...			</subreport>		</band>	</detail>...
Link to comment
Share on other sites

p.s. I forgot to mention, I know I can put the reports in different sections (e.g.: have one on the summary section). The example provided is a simple example, I plan to incorporate an arbitrary number of subreports into the report. Please try to keep the subreports in the same section when providing help or indicating if this is possible.

Thanks once again!

Link to comment
Share on other sites

Thanks for your quick response,

I direction fill value is vertical.  I'm ataching all the .jrxmls that generated this report (in case you want to check any additional information) and also highlighting in the code section below the relevant parts of these files to save you some time:

testME.jrxml   = parent
t0.jrxml            = child
t1.jrxml            = child

Regards,

 

Ricardo Ulate

Code:
==================================================Relevant code from testME.jrxml:==================================================...<jasperReport name="testME" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30">...	<detail>		<band height="2">			<subreport>			...			</subreport>			<subreport>			...			</subreport>		</band>	</detail>...</jasperReport>==================================================Relevant code from t0.jrxml:==================================================...<jasperReport name="t0" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isFloatColumnFooter="true">	<property name="adjustPageHeight" value="true"/>	<property name="adjustPageWidth" value="true"/>	...	<columnHeader>		<band>			<frame>				<reportElement positionType="Float" x="0" y="0" width="1026" height="0"/>			...			</frame>		</band>	</columnHeader>	<detail>		<band height="11">			<frame>				<reportElement positionType="Float" x="0" y="0" width="1026" height="11"/>			...			</frame>		</band>	</detail>...</jasperReport>==================================================Relevant code from t1.jrxml:==================================================...<jasperReport name="t1" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isFloatColumnFooter="true">	<property name="adjustPageHeight" value="true"/>	<property name="adjustPageWidth" value="true"/>	...	<columnHeader>		<band>			<frame>				<reportElement positionType="Float" x="0" y="0" width="240" height="0"/>			...			</frame>		</band>	</columnHeader>	<detail>		<band height="11">			<frame>				<reportElement positionType="Float" x="0" y="0" width="240" height="11"/>			...			</frame>		</band>	</detail>...</jasperReport>
Link to comment
Share on other sites

  • 3 weeks later...

 

Hi,

I haven't heard back from anyone for a while with this issue.  Clearly, the setPositionType as Float property isn't working for me.  Would this be a bug? (if so, may I ask for a work around or a fix in a subsequent release?) or is this something I'm doing wrong?

Regards,

 

Ricardo

 

Link to comment
Share on other sites

shrije
Wrote:

You mention that you need an arbritatry number of subreports. How do you decide the no of subreports ?

My company requires a reporting tool that is very simple to use.  Every setting that can will have a default.  The page size will default to the letter page size (for easy printing) when selecting PDF, or will default to ignorePaginationWhen when selecting html.

A user will be able to add Report Components through a simple add method:

report = new Report ("output.pdf");

report.addImage("image.jpeg");

report.addTable("file.csv");

report.addTable("file2.csv");

report.generate();

The report components will be position one beneth the other.

 

As you can see, the number of tables in a report can vary according to the user's selection (each table is a sub report).  Most of this is implemented already and working correctly, but when a table is added, it overlaps with whatever comes after.

When using other report componets that grow in size (like crosstabs), the setPositionType Float works fine.

Link to comment
Share on other sites

  • 3 years later...

Take a look at this link: http://stackoverflow.com/questions/353928/jasperreports-subreports-not-working-with-positiontype-float

For 2 subreports, it has to be done like this: set Position Type of the first one to "Fix Relative to Top". The second subreport has to be set to float. Also, the second subreports' "y" attribute must be equal to the first subreport "y" attribute plus the first subreport "height" attribute. Example:

 

<subreport>
                <reportElement x="38" y="38" width="347" height="1" isRemoveLineWhenBlank="true"/>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{subreport1})]]></dataSourceExpression>
                <subreportExpression><![CDATA[$P{RemarkSubReport}]]></subreportExpression>
  </subreport>
  <subreport>
                <reportElement positionType="Float" mode="Opaque" x="38" y="39" width="480" height="1"  isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true"/>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{subreport2})]]></dataSourceExpression>
                <subreportExpression><![CDATA[$P{DetailSubReport}]]></subreportExpression>
</subreport

Link to comment
Share on other sites

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