0中显示一个空表

0中显示一个空表

本文介绍了如何在iReport 3.0.0中显示一个空表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在修改一个现有的iReport文件,据说该文件要求程序输入.然后将输入放置在一个表中,我认为该表会在数据输入时自动添加行.

I'm modifying an existing iReport file, one that supposedly asks for an input from a program. The input is then placed in a table, which I assume, automatically adds rows as the data comes in.

但是,该程序不会输出数据,也不再需要这样做.所以现在我只需要显示一个空表即可.

However, the program isn't putting out the data, and is no longer required to do so. So now I only need an empty table to be displayed.

我在iReport中所做的是删除所有参数痕迹(因为不再需要它们,并复制并粘贴所有单元格直到它们到达页面底部.现在所有单元格都没有(标题除外) ,和第一行,因为它们具有静态文本),并且其中一个报告甚至显示空白页.

What I've done in iReport is to remove all traces of parameters (since they are no longer needed, and copy and paste all the cells until they reach the bottom of the page. Now none of the cells (except the header, and top row, because they have static text) are visible, and one of the reports even went as far as displaying a blank page.

我尝试将报表属性:无数据时"设置为无数据节"或所有节无细节",但是它仍然是空的,没有可见的单元格.我还尝试在文本字段中放置一个空格,希望它会显示出来,甚至将它们替换为矩形(在另一个报表中也是如此).但是,没有任何效果.报告仍只显示标题.

I've tried setting the Report Properties: When No Data: to either No Data Section, or All Sections-No Detail, but it's still empty with no visible cells. I've also tried putting a space in the textfields, hoping that it would show, and even replacing them with rectangles (which worked in another report). However, nothing worked. The reports still show only the header.

我该如何解决?谢谢.

这是JRXML:

<?xml version="1.0" encoding="UTF-8"  ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
         name="ApprenticeEmployment1"
         columnCount="1"
         printOrder="Vertical"
         orientation="Landscape"
         pageWidth="1008"
         pageHeight="612"
         columnWidth="948"
         columnSpacing="0"
         leftMargin="30"
         rightMargin="30"
         topMargin="20"
         bottomMargin="20"
         whenNoDataType="AllSectionsNoDetail"
         isTitleNewPage="false"
         isSummaryNewPage="false">
    <property name="ireport.scriptlethandling" value="0" />
    <property name="ireport.encoding" value="UTF-8" />
    <import value="java.util.*" />
    <import value="net.sf.jasperreports.engine.*" />
    <import value="net.sf.jasperreports.engine.data.*" />

    <parameter name="imagedir" isForPrompting="false" class="java.lang.String"/>

    <field name="REGION" class="java.lang.String"/>
    <field name="PROVINCE" class="java.lang.String"/>
    <field name="FULL_QUALIFICATION" class="java.lang.String"/>
    <field name="DELIVERY" class="java.lang.String"/>
    <field name="SECTOR" class="java.lang.String"/>
    <field name="STUDENT_ID" class="java.lang.String"/>
    <field name="LAST_NAME" class="java.lang.String"/>
    <field name="FIRST_NAME" class="java.lang.String"/>
    <field name="MI" class="java.lang.String"/>
    <field name="CONTACT_NUMBER" class="java.lang.String"/>
    <field name="E_MAIL" class="java.lang.String"/>
    <field name="STREET" class="java.lang.String"/>
    <field name="BARANGAY" class="java.lang.String"/>
    <field name="CITY" class="java.lang.String"/>
    <field name="SEX" class="java.lang.String"/>
    <field name="DOB" class="java.lang.String"/>
    <field name="AGE" class="java.math.BigDecimal"/>
    <field name="CIVIL_STAT" class="java.lang.String"/>
    <field name="EDUC_LEVEL" class="java.lang.String"/>
    <field name="DATE_STARTED" class="java.lang.String"/>
    <field name="DATE_FINISHED" class="java.lang.String"/>
    <field name="REMARKS" class="java.lang.String"/>

        <background>
            <band height="0"  isSplitAllowed="true" >
            </band>
        </background>
        <title>
            <band height="51"  isSplitAllowed="true" >
                <staticText>
                    <reportElement
                        x="0"
                        y="30"
                        width="948"
                        height="21"
                        key="staticText-1"/>
                    <box></box>
                    <textElement textAlignment="Center" verticalAlignment="Bottom">
                        <font pdfFontName="Helvetica-Bold" isBold="true"/>
                    </textElement>
                <text><![CDATA[Apprentice Report Form]]></text>
                </staticText>
                <image  hAlign="Center" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        x="238"
                        y="0"
                        width="470"
                        height="37"
                        key="image-1"/>
                    <box></box>
                    <graphicElement stretchType="NoStretch"/>
                    <imageExpression class="java.lang.String"><![CDATA[$P{imagedir}+"goldilocks-small.JPG"]]></imageExpression>
                </image>
            </band>
        </title>
        <pageHeader>
            <band height="0"  isSplitAllowed="true" >
            </band>
        </pageHeader>
        <columnHeader>
            <band height="65"  isSplitAllowed="true" >
                <staticText>
                    <reportElement
                        x="0"
                        y="18"
                        width="34"
                        height="31"
                        key="staticText-3"/>
                    <box>                   <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
</box>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font/>
                    </textElement>
                <text><![CDATA[Sex]]></text>
                </staticText>
                <staticText>
                    <reportElement
                        x="271"
                        y="18"
                        width="58"
                        height="31"
                        key="staticText-4"/>
                    <box>                   <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
</box>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font/>
                    </textElement>
                <text><![CDATA[Scholarship]]></text>
                </staticText>
                <staticText>
                    <reportElement
                        x="453"
                        y="18"
                        width="42"
                        height="31"
                        key="staticText-5"/>
                    <box>                   <topPen lineWidth="0.25"/>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
</box>
                    <textElement textAlignment="Center" verticalAlignment="Middle">
                        <font/>
                    </textElement>
                <text><![CDATA[Client Type
]]></text>
                </staticText>
                <staticText>
                    <reportElement
                        x="0"
                        y="1"
                        width="741"
                        height="17"
                        key="staticText-6"/>
            </band>
        </columnHeader>
        <detail>
            <band height="456"  isSplitAllowed="true" >
                <textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        x="0"
                        y="432"
                        width="34"
                        height="18"
                        key="textField-378"
                        stretchType="RelativeToTallestObject"
                        positionType="Float"/>
                    <textElement verticalAlignment="Middle">
                        <font size="8"/>
                    </textElement>
                <textFieldExpression   class="java.lang.String"><![CDATA[]]></textFieldExpression>
                </textField>
                <textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        x="0"
                        y="72"
                        width="34"
                        height="18"
                        key="textField-458"
                        stretchType="RelativeToTallestObject"
                        positionType="Float"/>
                    <textElement verticalAlignment="Middle">
                        <font size="8"/>
                    </textElement>
                <textFieldExpression   class="java.lang.String"><![CDATA[]]></textFieldExpression>
                </textField>
            </band>
        </detail>
        <columnFooter>
            <band height="0"  isSplitAllowed="true" >
            </band>
        </columnFooter>
        <pageFooter>
            <band height="0"  isSplitAllowed="true" >
            </band>
        </pageFooter>
        <summary>
            <band height="0"  isSplitAllowed="true" >
            </band>
        </summary>
</jasperReport>

尽管我确实编辑了很多框",所以如果格式错误,那就是我,而不是JRXML本身.

I did edit out a lot of 'boxes' though, so if the format's wrong, that's me and not the JRXML itself.

关于,Zack_Falcon

Regards,Zack_Falcon

推荐答案

您可以尝试这种情况

$P{Parameter}==null ? "All" : $P{Parameter}

如果不选择任何输入值,此条件将为您提供所有文本.

THis condition gives you All text if you don't select any input value.

这篇关于如何在iReport 3.0.0中显示一个空表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 21:26