当前位置: 首页 > 知识库问答 >
问题:

按下ENTER键后,无法在Jasper报告文档中添加新的段落

王英奕
2023-03-14

我需要生成一个jasper文档,可由用户编辑后使用Microsoft Word构建。我遇到的问题是,一旦生成文档,我就不能使用ENTER键在现有段落之间添加新段落。发生的情况是,文本消失在后面的段落,隐藏在下面。

下面是XML报告:

<?xml version="1.0" encoding="UTF-8"?>
<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="SolicitudPresupuestoCM" pageWidth="595" pageHeight="842" columnWidth="475" leftMargin="60" rightMargin="60" topMargin="20" bottomMargin="20" whenResourceMissingType="Key" uuid="255a457f-fbfa-4352-8d45-fb04f539febb">
    <property name="ireport.zoom" value="1.2396694214876032"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <property name="ireport.scriptlethandling" value="0"/>
    <property name="ireport.encoding" value="UTF-8"/>
    <import value="net.sf.jasperreports.engine.*"/>
    <import value="java.util.*"/>
    <import value="net.sf.jasperreports.engine.data.*"/>
    <parameter name="DIRECTORIO_IMAGENES" class="java.lang.String" isForPrompting="false"/>
    <parameter name="fechaPropuesta" class="java.util.Date" isForPrompting="false"/>
    <parameter name="numParrafosPrimerTexto" class="java.lang.Integer" isForPrompting="false"/>
    <parameter name="nombreFirma" class="java.lang.String" isForPrompting="false"/>
    <parameter name="cargoFirma" class="java.lang.String" isForPrompting="false"/>
    <parameter name="expediente" class="java.lang.String" isForPrompting="false"/>
    <parameter name="objeto" class="java.lang.String" isForPrompting="false"/>
    <parameter name="aplicacionPresupuestaria" class="java.lang.String" isForPrompting="false"/>
    <parameter name="importe" class="java.lang.String" isForPrompting="false"/>
    <parameter name="empresa" class="java.lang.String" isForPrompting="false"/>
    <parameter name="cif" class="java.lang.String" isForPrompting="false"/>
    <parameter name="numFactura" class="java.lang.String" isForPrompting="false"/>
    <queryString language="SQL">
        <![CDATA[]]>
    </queryString>
    <field name="texto" class="java.lang.String"/>
    <variable name="index" class="java.lang.Integer" incrementType="Report">
        <variableExpression><![CDATA[Integer.valueOf($V{index}.intValue() + 1)]]></variableExpression>
        <initialValueExpression><![CDATA[Integer.valueOf(0)]]></initialValueExpression>
    </variable>
    <pageHeader>
        <band height="101" splitType="Stretch">
            <textField isStretchWithOverflow="true" isBlankWhenNull="false">
                <reportElement uuid="dfc390b7-4917-47da-970f-d9e69de9626d" x="355" y="79" width="121" height="14"/>
                <textElement>
                    <font fontName="Arial" size="8" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{expediente}]]></textFieldExpression>
            </textField>
        </band>
    </pageHeader>
    <columnHeader>
        <band splitType="Stretch"/>
    </columnHeader>
    <detail>
        <band height="23" splitType="Stretch">
            <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false">
                <reportElement uuid="4fb4251a-765e-47b6-bd8d-60690d8df47a" x="0" y="0" width="475" height="10" isRemoveLineWhenBlank="true"/>
                <textElement textAlignment="Justified">
                    <font fontName="Arial" size="11" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{texto}]]></textFieldExpression>
            </textField>
        </band>
        <band height="73" splitType="Stretch">
            <staticText>
                <reportElement uuid="d0ec9d8d-de99-4b1f-a5f2-bd43b7ddd478" isPrintRepeatedValues="false" x="0" y="0" width="221" height="14" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <text><![CDATA[OBJECT: Payment of the invoice number]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="f8151046-97b5-452c-9423-50eea1b9f5d3" isPrintRepeatedValues="false" x="0" y="14" width="60" height="14" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <text><![CDATA[AMOUNT:]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="2fa9090a-0ecd-4084-8947-48bfc161bd16" isPrintRepeatedValues="false" x="0" y="28" width="73" height="15" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <text><![CDATA[APLICATION:]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="3abdff65-88a4-4201-af12-2d89c9e9b2cd" isPrintRepeatedValues="false" x="0" y="43" width="100" height="15" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <text><![CDATA[BIDDER:]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="eecdd67b-eb52-47e3-ae9e-fd5be9f0578e" isPrintRepeatedValues="false" x="335" y="43" width="47" height="15" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <text><![CDATA[NIF/CIF:]]></text>
            </staticText>
            <textField isStretchWithOverflow="true" isBlankWhenNull="false">
                <reportElement uuid="45e2af4d-aa76-4d8a-b736-09b9298b24c1" isPrintRepeatedValues="false" x="60" y="14" width="415" height="14" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{importe}]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="false">
                <reportElement uuid="0a69cee5-7970-4972-9b74-ebc4fe6687d5" isPrintRepeatedValues="false" x="77" y="28" width="306" height="15" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{aplicacionPresupuestaria}]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="false">
                <reportElement uuid="ea832f4b-30cd-4240-84dd-c39a01674540" isPrintRepeatedValues="false" x="100" y="43" width="235" height="15" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{empresa}]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="false">
                <reportElement uuid="291d18a5-4e09-41af-81ef-38da536f868b" isPrintRepeatedValues="false" x="383" y="43" width="92" height="15" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{cif}]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement uuid="15cc14e4-06ec-4c5f-92ff-5f7261bc83f8" isPrintRepeatedValues="false" x="221" y="0" width="58" height="14" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{numFactura}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement uuid="9e5ab1d9-008f-44c5-b25a-c95184f1ff1b" isPrintRepeatedValues="false" x="279" y="0" width="86" height="14" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <text><![CDATA[realtive to]]></text>
            </staticText>
            <textField isStretchWithOverflow="true" isBlankWhenNull="false">
                <reportElement uuid="7c57f57d-033d-4e85-8f18-d2f40521e5b3" isPrintRepeatedValues="false" x="365" y="0" width="110" height="14" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="11" pdfFontName="Arial" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{objeto}]]></textFieldExpression>
            </textField>
        </band>
        <band height="85" splitType="Stretch">
            <textField isStretchWithOverflow="true" isBlankWhenNull="false">
                <reportElement uuid="386f28db-aa1e-46e8-8c31-dd01a5c041c8" x="0" y="20" width="475" height="20" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="11" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{cargoFirma}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement uuid="d4e52606-aaf0-48a8-8dd3-b1532b0f5eed" key="staticText" isPrintRepeatedValues="false" x="0" y="0" width="135" height="20" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="11" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <text><![CDATA[Somewhere,]]></text>
            </staticText>
            <textField isStretchWithOverflow="true" isBlankWhenNull="false">
                <reportElement uuid="a8ceb09b-bc70-4875-90de-877cf9889351" isPrintRepeatedValues="false" x="0" y="65" width="475" height="20" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="11" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{nombreFirma}]]></textFieldExpression>
            </textField>
            <textField pattern="dd/MM/yyyy" isBlankWhenNull="false">
                <reportElement uuid="71a758b9-a5bc-4890-ae2f-74263245d0c4" isPrintRepeatedValues="false" x="135" y="0" width="220" height="20" isRemoveLineWhenBlank="true">
                    <printWhenExpression><![CDATA[Boolean.valueOf(($V{index} == $P{numParrafosPrimerTexto}))]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font fontName="Arial" size="11" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{fechaPropuesta}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <columnFooter>
        <band splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="122">
            <staticText>
                <reportElement uuid="47118a66-c23c-4b35-b90f-7e469eb97a99" key="staticText" x="0" y="0" width="73" height="20"/>
                <textElement>
                    <font fontName="Arial" size="11" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <text><![CDATA[Otherwhere,]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="880fd5a8-8a35-49d2-b226-5413d7d02120" key="staticText" x="0" y="20" width="475" height="20"/>
                <textElement>
                    <font fontName="Arial" size="11" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <text><![CDATA[The director of ...]]></text>
            </staticText>
            <staticText>
                <reportElement uuid="6a5f6b70-0574-4c6f-8e44-09356eda2a51" key="staticText" x="0" y="71" width="475" height="20"/>
                <textElement>
                    <font fontName="Arial" size="11" pdfEncoding="Cp1252" isPdfEmbedded="true"/>
                </textElement>
                <text><![CDATA[Charles Irwin]]></text>
            </staticText>
        </band>
    </pageFooter>
</jasperReport>

下面是我应该在构建后轻松自定义的结果文档。转到下载文档

共有1个答案

劳宇
2023-03-14

JasperReports通过使用表来实现文档的布局。在MS Word中,您应该可以通过选择表格工具>布局>显示网格线来看到这一点。所有行都有一个特定的固定高度,因此当添加超出单元格大小的内容时,它将不可见。

若要在添加新段落时使单元格增长,请在要添加内容的单元格内单击右键,然后选择表格属性....在行选项卡上,取消选中指定高度旁边的框。然后,行高应该增加以容纳内容。

 类似资料:
  • 是否可以在报告中添加一个按钮,任何操作都将被修复? 示例:按钮“查看”,将显示更详细的统计信息。 备注: 我不完全理解如何制作文本元素的按钮

  • 我有一个Java的DTO对象设计如下: 我给Jasper的DTO产品是这样的: 使用Jaspersoft Studio,我可以轻松显示字段名称,但我找不到显示客户端列表的方法。 我尝试使用调色板中可用的元素List,但它需要一个数据集。好了,我创建了一个clientDataset。但是,我如何向clientDataset提供客户端列表?

  • 我正在从. jasper文件加载jasper报告文件以提高性能,如下所示。 但是我现在有一个要求,动态形成的查询必须设置为. jasper(编译)文件。有没有办法做同样的事情?

  • 我在运行这个代码时遇到了一个问题。我总是收到这样的消息:“文档没有页面”,在pdf文件中有一个空白页。 注意:我使用的是NetBeans IDE7.2测试版。 null 这是我的代码: 我真的很感激你的帮助。

  • 使用text field value editor我将一个带有条件的文本添加到文本字段中(注意if是使用JasperSoft studio的字段编辑器构造的,所以if(...)代码是自动生成的,我只给出了值“pippo”和“pluto”)

  • 问题内容: 我正在使用詹金斯(Jenkins)来进行将maven与黄瓜配合使用的工作。我的工作顺利进行。我还用jenkins管理了插件Cucumber报告。但是当我查看报告时,我收到如下图所示的消息。 我尝试安装各种插件,例如Jenkins插件,独立但没有任何乐趣。这些在选项的右下方显示为选项。 任何线索都是有帮助的。我也尝试过检查stackover流中的此错误。我没有任何线索 我可以看到由sur