manigandanms Posted November 17, 2009 Share Posted November 17, 2009 Hi,I am using Jasper 3.5.1.I have designed my report using iReport. I have a main report in which I am calling 2 subreports. My report data is represented as below.Column Label1 : Column Value1Column Label2 : Column Value2Column Label N : Column Value NI have put the label and value in a frame so that when the data in the value is too big the next column will get adjusted accordingly. I have represented the above label and value in text field who's position is float. So far so good.When there is no corresponding value for a label I am not printing the label and column to save space in the report. This also works great. But in the end of each page based on the number of label/Value I dont print, I get empty lines.Please let me know if you have any solution to get rid of empty space.Thanks,ManiPost Edited by manigandanms at 11/17/2009 09:14 Link to comment Share on other sites More sharing options...
lshiva56 Posted November 17, 2009 Share Posted November 17, 2009 try to post some code..it will be very helpfull..... Thanks Link to comment Share on other sites More sharing options...
Teodor Danciu Posted November 18, 2009 Share Posted November 18, 2009 Hi, You are using a very big detail section. In that case, please try set splitType="Immediate" for your detail band. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
manigandanms Posted November 18, 2009 Author Share Posted November 18, 2009 On the detail band I selected splitType="Immediate" but when I compile my jrxml I get an compilation error.Error compiling report design : D:ManiHomeprojectslprmodulesservicesreportsrcmainjasperreportserrorContactsPDF.jrxmlError compiling report design : D:ManiHomeprojectslprmodulesservicesreportsrcmainjasperreportserrorContactsPDF.jrxml : org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'splitType' is not allowed to appear in element 'band'.Post Edited by manigandanms at 11/19/2009 14:11 Link to comment Share on other sites More sharing options...
manigandanms Posted November 19, 2009 Author Share Posted November 19, 2009 splitType=Immediate is not supported in the jasper version which I am using. I am using Jasper 3.5.3,I used isSplitAllowed=true instead but it didnt serve the purpose. I still get white spaces in the report. Ahh!!!!Post Edited by manigandanms at 11/19/2009 14:11 Link to comment Share on other sites More sharing options...
Teodor Danciu Posted November 20, 2009 Share Posted November 20, 2009 Hi, We would not be patching JR 3.5.1, to add this new feature to it. So you just need to upgrade. Thanks,Teodor Link to comment Share on other sites More sharing options...
manigandanms Posted November 20, 2009 Author Share Posted November 20, 2009 I was compiling the JRXML using 3.5.1 thats how splitType=Immediate was not working. But once I changed the compiler version to 3.5.3 it was generating .jasper files. But the original problem of getting white space when there was no data printed is still there. Post Edited by manigandanms at 11/20/2009 15:25Post Edited by manigandanms at 11/20/2009 15:26 Link to comment Share on other sites More sharing options...
Teodor Danciu Posted November 20, 2009 Share Posted November 20, 2009 Hi, You did not show what you have in these subreports there. Maybe the white space is caused by them. Thanks,Treodor Link to comment Share on other sites More sharing options...
manigandanms Posted November 23, 2009 Author Share Posted November 23, 2009 Could be. I have attached the subreport. Please let me know if I am doing something wrong.I have also attached the sample report as a gif file (sampleReport.GIF). In the screen shot the left panel report is printed which doesnt have the printwhenexpression on the frame element so it prints the label and corresponding text. And in the right panel in the sample screenshot you can see white space though there is content which needs to be continued. In this report template it contains printwhenexpression on the frame element.Post Edited by manigandanms at 11/23/2009 10:16 Link to comment Share on other sites More sharing options...
xtrbusek Posted November 23, 2009 Share Posted November 23, 2009 It seem that I have the same or very similar problem. I already wrote it here http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=66840 . It will be fine if we can find any solution or workaround. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted November 23, 2009 Share Posted November 23, 2009 Hi, The main report contains 3 subreports and you attached only 2.In the meantime, can you make the subreport elements of height=1, just to see if the white space comes from subreport elements that are empty? Thanks,Teodor Link to comment Share on other sites More sharing options...
manigandanms Posted November 23, 2009 Author Share Posted November 23, 2009 Changing the subreport element height=1 didnt make any difference in the report output. I have attached souce code of the 3rd subreport. Please find it attached. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted November 23, 2009 Share Posted November 23, 2009 Hi, When you are testing this report, are you using iReport 3.5.3?Or you are using iR only for report design and you then actually run them on same other application that has JR as a dependency? In case you do it from iR, the best way to spot the problem would be to send us a CSV file with some data that would help us reproduce the problem locally. Thank you,Teodor Link to comment Share on other sites More sharing options...
manigandanms Posted November 23, 2009 Author Share Posted November 23, 2009 I am using iReport to only build the report template (.jrxml). To test if this is working I make a .jasper file with the maven plugin and then use my application to retrieve the records from the database and fill it to the generated template. I am using iReport 3.5.2 and in maven to compile and package my application I use jasper 3.5.3Do you recommend replacing the subreports with <jr:list> component to iterate the list and display the recordset? I tried using sample code snippet as below but I dont know how to declare the variables in it and i dont see any example in the demo folder of jasper. <componentElement> <reportElement positionType="Float" x="15" y="386" width="400" height="20"/> <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> <datasetRun subDataset="dataset1"> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{primarySksCodes})]]></dataSourceExpression> </datasetRun> <jr:listContents height="20"> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement positionType="Float" x="1" y="0" width="100" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{code.concatenatedDescription}]]/> </textField> </jr:listContents> </jr:list> </componentElement>I have also attached sample data which is in csv format. Please look at it.Between we am struck with this problem from more than a week, we are also thinking of evaluating other tools if this becomes the road block for us. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted November 23, 2009 Share Posted November 23, 2009 Hi, I'm not suggesting anything. I'm just trying to see why the splitType="Immediate" does not work for you.I would double check to see if the application that runs the reports uses JR 3.5.3 indeed.If it does not use JR 3.5.3, but an older version, than the fact that you compiled with 3.5.3 is completely irrelavant, because although the setting is present in the report, the older program does not make use of it. In any case, you have a complicate working environment in which you use several different version of our products. I suggest you simply upgrade everywhere and eliminate version mismatches. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
manigandanms Posted November 23, 2009 Author Share Posted November 23, 2009 I cross checked my deployed ear file which generates the report and it is having jasper 3.5.3 version. Can you point me to a sample code which uses <jr:list> ? Link to comment Share on other sites More sharing options...
manigandanms Posted November 23, 2009 Author Share Posted November 23, 2009 Hi Teodor,I had attached the csv data file as you had asked for, were you able to mimic the problem? Please let me know.Thanks,Mani Link to comment Share on other sites More sharing options...
manigandanms Posted November 24, 2009 Author Share Posted November 24, 2009 Hi Teodor,I have upgraded Jasper to the latest edition 3.6.1 and set the detail band splitType=Immediate but I can still see white space in my pdf report. Any suggestions please?Thanks,ManiPost Edited by manigandanms at 11/24/2009 07:38 Link to comment Share on other sites More sharing options...
Teodor Danciu Posted November 24, 2009 Share Posted November 24, 2009 Hi, I cannot run your reports because they are missing important resources such as style templates, resource bundles, etc.So I think you need to help yourself by trying to figure out at least from which report section or subreport is the white space originating.I suggest you make the subreport elements in the master report opaque and assign them a back color that would help us understand which content comes from which subreport. You then could attach here a generated PDF, not only some screenshots. It is important to see the whole document because it is important to see what is coming on the next page, after the white space region. It is that content on the next page which has caused the white space in the first place, and we never saw that. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
xtrbusek Posted November 24, 2009 Share Posted November 24, 2009 I have tried set background color to black in my report ( http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=66840 ) as you suggested. But I see that white spaces at the end of page are white. You can look at our attached report sources. They can be compilled, contain source xml data and are ready to evaluate several tests.I have attached also generated pdf file with frame bg color set to grey.Post Edited by xtrbusek at 11/24/2009 09:04 Link to comment Share on other sites More sharing options...
manigandanms Posted November 24, 2009 Author Share Posted November 24, 2009 Hi Teodor,Please find attached sample reports generated. I have assigned 4 different colors(Main report followed by 3 subreports) so that it will be easy to identify.Report file sampleReportWithoutPrintWhenCondition.pdfIn this sample report I have not used printWhenExpression on the frames <reportElement>. Sample code as below.<frame> <reportElement positionType="Float" mode="Opaque" x="15" y="47" width="472" height="20" isRemoveLineWhenBlank="true" backcolor="#9999FF"/> <textField isStretchWithOverflow="true" isBlankWhenNull="false"> <reportElement style="Arial_Bold" positionType="Float" mode="Opaque" x="1" y="-1" width="141" height="20" isRemoveLineWhenBlank="true" backcolor="#9999FF"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$R{generic.label.residential}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement key="" style="Arial_Normal" positionType="Float" mode="Opaque" x="142" y="0" width="329" height="20" isRemoveLineWhenBlank="true" backcolor="#9999FF"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{county.concatenatedDescription}]]></textFieldExpression> </textField> </frame>Report file sampleReportWithPrintWhenCondition.pdfIn this sample report I have used printWhenExpression on the frames <reportElement>. Sample code as below.<frame> <reportElement positionType="Float" mode="Opaque" x="15" y="47" width="472" height="20" isRemoveLineWhenBlank="true" backcolor="#9999FF"> <printWhenExpression><![CDATA[$F{county.concatenatedDescription}!=null]]></printWhenExpression> </reportElement> <textField isStretchWithOverflow="true" isBlankWhenNull="false"> <reportElement style="Arial_Bold" positionType="Float" mode="Opaque" x="1" y="-1" width="141" height="20" isRemoveLineWhenBlank="true" backcolor="#9999FF"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$R{generic.label.residential}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement key="" style="Arial_Normal" positionType="Float" mode="Opaque" x="142" y="0" width="329" height="20" isRemoveLineWhenBlank="true" backcolor="#9999FF"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{county.concatenatedDescription}]]></textFieldExpression> </textField> </frame> Note:My report is based on 2 attributes like label and its corresponding value. I am using printWhenCodition in the <reportElement> of the frame since I dont want to print the label when there is no corresponding value. Please let me know if my apprach is right.Thanks,ManiPost Edited by manigandanms at 11/24/2009 09:34Post Edited by manigandanms at 11/24/2009 09:36 Link to comment Share on other sites More sharing options...
Teodor Danciu Posted November 24, 2009 Share Posted November 24, 2009 Hi, Now that you have upgraded to JR 3.6.1, please split the master report section into multiple bands.Note that the <detail> tage can contain multiple <band> tags. Isolate each subreport into its own detail band in the master. Also, I think your subreports are actually filled with many empty records. You probably count on the empty lines to be removed and collapse, which probably happens. Except that in your subreport designs, you have always left some 1 or 2 pixel gaps within the bands, for padding. These 1 or 2 pixels do not collapse or dissappear when the record is empty. Only empty text field space collapses. And if you have very many empty records, those few pixels become a huge white space. I hope this helps.TeodorPost Edited by teodord at 11/24/2009 09:56 Link to comment Share on other sites More sharing options...
manigandanms Posted November 24, 2009 Author Share Posted November 24, 2009 Hi Teodor,White space is gone once I added the subreport in different detail band!!!!Thanks very much for your support, its highly appreciated.In the maven global repository http://repo2.maven.org/maven2/ there is no support for Jasper 3.6.1, I have read in few of the issues posted with this regards and the solution was to use our local repository. Any comments on this?Thanks,Mani Link to comment Share on other sites More sharing options...
nnvc Posted November 24, 2009 Share Posted November 24, 2009 Hi Teodor!.I want to know how can I manage multiple - bands with JRDesignGroup. In java how can I do that.Thanks in advance. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted December 10, 2009 Share Posted December 10, 2009 Hi, Please use the following public repository for JasperReports: <repository> <id>jasperreports</id> <url>http://jasperreports.sourceforge.net/maven2</url> </repository> We hope this will soon be synchronized with the Maven central repositories, as we have made a sync request here:http://jira.codehaus.org/browse/MAVENUPLOAD-2688 Thank you,Teodor 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