Jump to content

Page overflows with empty space when textfield stretches


antprochazka

Recommended Posts

Hello all. I am struggling with overflowing document. In my usecase I have a report with textfield showing input text parameter that can be generally multiple lines. What I want:

1) The document to be fix size of A4 unless the content overflows.

2) When the input parameter generates more lines than can fit into one A4 page then stretch the page to become taller.

For the sake of simplicity I have set fix content into my textfield (not using the input parameter). To simulate multiline input parameter value currently it consists of "a" followed by 18 newlines (<br>) and letter "b" at the end.

<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.9.0.final using JasperReports Library version 6.9.0-cb8f9004be492ccc537180b49c026951f4220bf3  --><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="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isIgnorePagination="true" uuid="315a7b0d-5c86-4525-85d8-b2ceba19bbf4">    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>    <queryString>        <![CDATA[]]>    </queryString>    <background>        <band splitType="Stretch"/>    </background>    <title>        <band height="79" splitType="Stretch"/>    </title>    <pageHeader>        <band height="35" splitType="Stretch"/>    </pageHeader>    <columnHeader>        <band height="61" splitType="Stretch"/>    </columnHeader>    <detail>        <band height="486">            <textField isStretchWithOverflow="true">                <reportElement x="0" y="0" width="10" height="12" uuid="8270fbc3-5b36-4f0d-976d-9ad192e8ef68"/>                <textElement markup="html">                    <font size="12"/>                </textElement>                <textFieldExpression><![CDATA["a<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>b"]]></textFieldExpression>            </textField>        </band>    </detail>    <columnFooter>        <band height="45" splitType="Stretch"/>    </columnFooter>    <pageFooter>        <band height="54" splitType="Stretch"/>    </pageFooter>    <summary>        <band height="42" splitType="Stretch"/>    </summary></jasperReport>[/code]

Current (undesired) output:
current_undesired.png.df437578109b4b1ad1705b702caa3191.png

Desired output:

desired.png.95a2ab43cbf393531a5823d0751e6a07.png

Acceptable solutions for me:

1) Shrink the page height always to max(real content height, A4 height). I absolutely do not want the page to stretch by empty space.

2) Set  isIgnorePagination to "false" and generate 2nd page with overflowing content when there is not enough space on the first page. If I try it now it generates 2nd EMPTY A4 page which is definitely not what I want. Still this is worse solution because I am generating electronically signable documents where it is more suitable to have one page stretched (by CONTENT, no empty space) than have two pages.

 

Thank you very much for your answers guys. I have been looking for solving my problem for a long time but I still have not found sufficient answer.

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

To keep the page format you may need to uncheck "Ignore Pagination".

Values

true

 

The report will be generated on one long page. The specified page height will still be used for report design.

false

 

The report will be paginated according to the pageHeight attribute.

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