inditrozen Posted February 1, 2008 Share Posted February 1, 2008 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 More sharing options...
C-Box Posted February 4, 2008 Share Posted February 4, 2008 Use Position-Type = FLOAT instead of FixRelativeToTop (=standard) to all the SubReports. hthC-Box Link to comment Share on other sites More sharing options...
inditrozen Posted February 4, 2008 Author Share Posted February 4, 2008 thx it helped Link to comment Share on other sites More sharing options...
rulate Posted October 1, 2008 Share Posted October 1, 2008 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.0Thanks in advance, Ricardo UlateCode:... <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 More sharing options...
rulate Posted October 1, 2008 Share Posted October 1, 2008 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 More sharing options...
C-Box Posted October 2, 2008 Share Posted October 2, 2008 Code:What is your fill direction of master report? C-Box Link to comment Share on other sites More sharing options...
rulate Posted October 2, 2008 Share Posted October 2, 2008 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 = parentt0.jrxml = childt1.jrxml = childRegards, Ricardo UlateCode:==================================================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 More sharing options...
itchytoes Posted October 2, 2008 Share Posted October 2, 2008 Hi --This is just a shot in the dark. I've never tried calling a subreport with height="0" before.I notice the 2nd one starts at y="1". What happens if you give each of them a height="1"? Betty Link to comment Share on other sites More sharing options...
itchytoes Posted October 2, 2008 Share Posted October 2, 2008 Oops -- I meant just give the first one a height="1" Link to comment Share on other sites More sharing options...
rulate Posted October 3, 2008 Share Posted October 3, 2008 Setting the height to 1 of the sub reports did not work, but thanks for your suggestion. Link to comment Share on other sites More sharing options...
rulate Posted October 20, 2008 Share Posted October 20, 2008 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 More sharing options...
shrije Posted October 21, 2008 Share Posted October 21, 2008 You mention that you need an arbritatry number of subreports. How do you decide the no of subreports ? Link to comment Share on other sites More sharing options...
rulate Posted October 21, 2008 Share Posted October 21, 2008 shrijeWrote: 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 More sharing options...
damm Posted June 5, 2012 Share Posted June 5, 2012 Take a look at this link: http://stackoverflow.com/questions/353928/jasperreports-subreports-not-working-with-positiontype-floatFor 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 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