german-b Posted December 10, 2008 Share Posted December 10, 2008 I'm trying to get the positionType="Float" feature to work in a simple scenario with subreports. For some reason, both subreports are displayed taking both x and y. Am I doing something wrong? Here's my jrxml ... assume the subreport is some silly arbitrary static stuff.Thanks! Code:<?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report name" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA["C:\reportFolder\"]]></defaultValueExpression> </parameter> <background> <band/> </background> <detail> <band height="200"> <subreport> <reportElement positionType="FixRelativeToTop" x="19" y="0" width="200" height="50"/> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression> <subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "report1.jasper"]]></subreportExpression> </subreport> <subreport> <reportElement positionType="Float" mode="Transparent" x="19" y="20" width="200" height="50" backcolor="#FFFF66"/> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression> <subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "report1.jasper"]]></subreportExpression> </subreport> </band> </detail></jasperReport> Link to comment Share on other sites More sharing options...
lucianc Posted December 11, 2008 Share Posted December 11, 2008 Your subreports are overlapping. Set y="50" for the second subreport.HTH,Lucian Link to comment Share on other sites More sharing options...
german-b Posted December 11, 2008 Author Share Posted December 11, 2008 Thanks Lucian! I realized this yesterday. Since the docs said that in this case y is ignored, I didn't think its value mattered at all. So, in order to have it float, you need to place it right below the previous element according to its declared position and height. Link to comment Share on other sites More sharing options...
plunavat Posted March 23, 2022 Share Posted March 23, 2022 Make Position Typt to "float" and make Stretch Type to "no stretch" 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