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

White space at the end of each page


manigandanms

Recommended Posts

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 Value1

Column Label2 : Column Value2

Column Label N : Column Value N

I 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,

Mani



Post Edited by manigandanms at 11/17/2009 09:14
Link to comment
Share on other sites

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

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

Error 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

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:25



Post Edited by manigandanms at 11/20/2009 15:26
Link to comment
Share on other sites

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

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

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

Do 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

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

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

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

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

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

In 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,

Mani



Post Edited by manigandanms at 11/24/2009 09:34



Post Edited by manigandanms at 11/24/2009 09:36
Link to comment
Share on other sites

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



Post Edited by teodord at 11/24/2009 09:56
Link to comment
Share on other sites

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

  • 3 weeks later...

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

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