Jasperreport删除框架内的垂直空间

时间:2015-12-23 16:16:11

标签: jasper-reports

我有一个jasperreport,我正在尝试减少其两帧的垂直大小。正如您在此截图中所见

enter image description here

3帧(周围帧和两个内部帧)大于内容。

我一直在努力将其尺寸缩小到内容的大小,但没有成功。任何想法我能做什么? par1 = null,par2 = 2,par3 = 3,par4 = 4.

我的jasperreport:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0  -->
<!-- 2015-12-23T18:22:07 -->
<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="report2" language="groovy" pageWidth="979" pageHeight="693" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="979" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="a6ccd207-3a74-42e6-8486-fc3b01795fb5">
    <parameter name="par1" class="java.lang.String">
        <defaultValueExpression><![CDATA[null]]></defaultValueExpression>
    </parameter>
    <parameter name="par2" class="java.lang.String">
        <defaultValueExpression><![CDATA[null]]></defaultValueExpression>
    </parameter>
    <parameter name="par3" class="java.lang.String">
        <defaultValueExpression><![CDATA[null]]></defaultValueExpression>
    </parameter>
    <parameter name="par4" class="java.lang.String">
        <defaultValueExpression><![CDATA[null]]></defaultValueExpression>
    </parameter>
    <title>
        <band height="141" splitType="Stretch">
            <line>
                <reportElement x="10" y="6" width="520" height="1" uuid="ebfc40ae-a2ee-40fc-b585-4236e9fa3c63"/>
            </line>
            <line>
                <reportElement x="0" y="110" width="520" height="1" uuid="7657216f-1366-4455-adb0-db58e2333b5c"/>
            </line>
            <frame>
                <reportElement x="329" y="10" width="172" height="43" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="0fbab6b3-f5ea-4716-b954-9371b4640781">
                    <property name="ShowOutOfBoundContent" value="false"/>
                </reportElement>
                <box>
                    <topPen lineWidth="0.4"/>
                    <leftPen lineWidth="0.4"/>
                    <bottomPen lineWidth="0.4"/>
                    <rightPen lineWidth="0.4"/>
                </box>
                <frame>
                    <reportElement positionType="Float" x="13" y="3" width="60" height="40" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="8a663ee5-c983-40f9-b85e-11bc852f46cc">
                        <property name="ShowOutOfBoundContent" value="false"/>
                    </reportElement>
                    <box>
                        <topPen lineWidth="0.4"/>
                        <leftPen lineWidth="0.4"/>
                        <bottomPen lineWidth="0.4"/>
                        <rightPen lineWidth="0.4"/>
                    </box>
                    <textField isBlankWhenNull="true">
                        <reportElement x="1" y="20" width="52" height="20" isRemoveLineWhenBlank="true" uuid="84504631-a04d-4f75-bcb2-9e20741f29ad"/>
                        <box>
                            <topPen lineWidth="1.0"/>
                            <leftPen lineWidth="1.0"/>
                            <bottomPen lineWidth="1.0"/>
                            <rightPen lineWidth="1.0"/>
                        </box>
                        <textFieldExpression><![CDATA[$P{par3} == null ? null : "P3: " + $P{par3}]]></textFieldExpression>
                    </textField>
                    <textField isBlankWhenNull="true">
                        <reportElement x="1" y="0" width="52" height="20" isRemoveLineWhenBlank="true" uuid="52c7e555-7e36-4992-8e59-b533fea31533"/>
                        <box>
                            <topPen lineWidth="1.0"/>
                            <leftPen lineWidth="1.0"/>
                            <bottomPen lineWidth="1.0"/>
                            <rightPen lineWidth="1.0"/>
                        </box>
                        <textFieldExpression><![CDATA[$P{par1} == null ? null : "P1: " + $P{par1}]]></textFieldExpression>
                    </textField>
                </frame>
                <frame>
                    <reportElement positionType="Float" x="73" y="3" width="70" height="40" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="3a53c02d-6559-4c64-8ca8-21254b50435e">
                        <property name="ShowOutOfBoundContent" value="false"/>
                    </reportElement>
                    <box>
                        <topPen lineWidth="0.4"/>
                        <leftPen lineWidth="0.4"/>
                        <bottomPen lineWidth="0.4"/>
                        <rightPen lineWidth="0.4"/>
                    </box>
                    <textField isBlankWhenNull="true">
                        <reportElement x="1" y="0" width="52" height="20" isRemoveLineWhenBlank="true" uuid="b0ca90f0-9364-4c4c-a8cf-1a54c60189a0"/>
                        <box>
                            <topPen lineWidth="1.0"/>
                            <leftPen lineWidth="1.0"/>
                            <bottomPen lineWidth="1.0"/>
                            <rightPen lineWidth="1.0"/>
                        </box>
                        <textFieldExpression><![CDATA[$P{par2} == null ? null : "P2: " + $P{par2}]]></textFieldExpression>
                    </textField>
                    <textField isBlankWhenNull="true">
                        <reportElement x="1" y="20" width="52" height="20" isRemoveLineWhenBlank="true" uuid="f8b11d9c-fa8c-4e58-805a-4a8305b1bec1"/>
                        <box>
                            <topPen lineWidth="1.0"/>
                            <leftPen lineWidth="1.0"/>
                            <bottomPen lineWidth="1.0"/>
                            <rightPen lineWidth="1.0"/>
                        </box>
                        <textFieldExpression><![CDATA[$P{par4} == null ? null : "P4: " + $P{par4}]]></textFieldExpression>
                    </textField>
                </frame>
            </frame>
        </band>
    </title>
</jasperReport>

编辑:

我试图减小帧的大小并将其removeLineWhenBlank属性设置为true,如果我设置值par1 = par2 = null,par3 = 3,par4 = 4,现在一切都消失了。为什么?我只想删除空白行,而不是所有行:

<html>

<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js" type="text/javascript"></script>
</head><body>


<div ng-app="myapp" ng-controller="movieCtrl">

<div star-rating rating="starRating" read-only="false" max-rating="10" click="click(param)" mouse-hover="mouseHover(param)"
        mouse-leave="mouseLeave(param)"></div>
        </div></body></html>

1 个答案:

答案 0 :(得分:0)

您生成报告的格式是什么?让我们假设您正在生成HTML格式的报告,以下技巧将完成这项工作。

<property name ="net.sf.jasperreports.export.html.using.images.to.align" value="false"/>

希望有所帮助。