oyanovych Posted January 22, 2015 Posted January 22, 2015 Hello guys, found one interesting problem in JasperReportmaybe it's a bug or maybe I need to set some additional attributes in my report... I'm using JasperReport version 5.2.0 injava desktop application Application have possibility to print different reports,and also include or exclude some parts or the same report if it is needed for user,to include/exclude parts I'm using frames with printWhenExpression parameter, and it looks ok.But when the reports contains many information and needed to print few pages,I got some extra space on a bottom of the report, with the same size like the size of the hidden frames I wrote a simple example that demonstrates the problem I found:<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 5.6.1.final using JasperReports Library version 5.6.1 --><!-- 2015-01-22T13:31:32 --><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="test" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="634da7d8-b377-4604-9a49-8a0d039e51fc"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <title> <band splitType="Stretch"/> </title> <detail> <band height="431" splitType="Stretch"> <frame> <reportElement key="" positionType="Float" mode="Transparent" x="0" y="0" width="555" height="400" isRemoveLineWhenBlank="true" uuid="d63d93fc-e77f-4045-aeef-afc5ac873b96"> <printWhenExpression><![CDATA[false]]></printWhenExpression> </reportElement> </frame> <textField isStretchWithOverflow="true"> <reportElement positionType="Float" x="0" y="401" width="90" height="30" isRemoveLineWhenBlank="true" uuid="894e9e9b-e823-42e2-abdd-a3517f662a98"> <printWhenExpression><![CDATA[true]]></printWhenExpression> </reportElement> <textFieldExpression><![CDATA["111 1111 1111 1111111111 1111111111111 1111111111111111111111 11111111111111111111111 1111111 111 1111 1222 222222 22 2222222 2222 22222222 2222 22222222 2222222 22222 22222222222 2222222222222 22222 222 22222 2222 222233 3333333333 333333 333 3333 33333 333333 3333333 33333333 333333 3333 44444 4 4 4 4 4 4 4 44 4 4 4 4 4 44 44 44 4 4 4 4444 4 4 4 44 6 6 6 6 6 6 6 6 67 7 7 7 7 7 7 7 7 7 7 7 7 78 8 8 8 8 8 8 8 8 88 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 99 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 000 0 0 0 0 00 00 0 00 0 0 0 0 0 0 0 0 00"]]></textFieldExpression> </textField> </band> </detail> <summary> <band splitType="Stretch"/> </summary></jasperReport>[/code]And here is the result:The text is splited to two pages, but it can be printed only on one page :-( :-( :-(maybe someone knows the reason?
Teodor Danciu Posted December 21, 2015 Posted December 21, 2015 Hi,I'm afraid this is expected behavior and we are not going to change it soon.You see, the removal of empty or non-printable elements is the last operation performed during container layout.Which means that by the time we calculate how much space each element has to expand, the white space is not yet reclaimed.I understand your sample report is just a hypothetical case, to show us the issue, but these situations can be worked around usually by putting collapsible content in separate bands.Note that certain report sections such as detail and group headers and footers are multi-band sections, which give you more flexibility on restructuring large sections into separate bands, that collapse independent of one another.I hope this helps.Teodor
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