我正在尝试使用Jasper报告以HTML格式创建报告。它正在创建.JRXML文件。但是在创建html文件时,Jasper会抛出异常
Caused by: net.sf.jasperreports.engine.JRRuntimeException: Crosstab has not printed anything on 3 consecutive pages, likely infinite loop
at net.sf.jasperreports.engine.fill.JRFillCrosstab.prepare(JRFillCrosstab.java:557)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:328)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:388)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:347)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillColumnBand(JRHorizontalFiller.java:2142)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillGroupFooter(JRHorizontalFiller.java:994)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillGroupFooters(JRHorizontalFiller.java:858)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillReportEnd(JRHorizontalFiller.java:315)
at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillReport(JRHorizontalFiller.java:144)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:903)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:832)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:84)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624)
at app.nova.power.util.PowerAnalysisUtil.getExportDataFile(PowerAnalysisUtil.java:803)
at app.nova.power.util.PowerAnalysisUtil.getExportFile(PowerAnalysisUtil.java:182)
at app.nova.power.actionimpl.DashBoardActions.executeAction(DashBoardActions.java:67)
... 159 more
当我的报告中有更多列时,会出现此异常。
这是我的.JRXML文件片段
<group name="FakeSummaryGroup" isStartNewColumn="true">
<groupHeader>
<band height="0" isSplitAllowed="true"></band>
</groupHeader>
<groupFooter>
<band height="65" isSplitAllowed="true">
<crosstab isRepeatColumnHeaders="false" isRepeatRowHeaders="false"
columnBreakOffset="100000">
<reportElement mode="Opaque" x="9" y="10" width="409"
height="40" key="crosstab-1" />
<crosstabParameter name="PROWS0" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PROWS0}]]></parameterValueExpression>
</crosstabParameter>
<crosstabParameter name="PCOLUMNS0" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PCOLUMNS0}]]></parameterValueExpression>
</crosstabParameter>
<crosstabParameter name="PCOLUMNS1" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PCOLUMNS1}]]></parameterValueExpression>
</crosstabParameter>
<crosstabParameter name="PCOLUMNS2" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PCOLUMNS2}]]></parameterValueExpression>
</crosstabParameter>
<crosstabParameter name="PCOLUMNS3" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PCOLUMNS3}]]></parameterValueExpression>
</crosstabParameter>
<crosstabParameter name="PCOLUMNS4" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PCOLUMNS4}]]></parameterValueExpression>
</crosstabParameter>
<crosstabParameter name="PCOLUMNS5" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PCOLUMNS5}]]></parameterValueExpression>
</crosstabParameter>
<crosstabParameter name="PCOLUMNS6" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PCOLUMNS6}]]></parameterValueExpression>
</crosstabParameter>
<crosstabParameter name="PCOLUMNS7" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PCOLUMNS7}]]></parameterValueExpression>
</crosstabParameter>
<crosstabParameter name="PCOLUMNS8" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PCOLUMNS8}]]></parameterValueExpression>
</crosstabParameter>
<crosstabParameter name="PCOLUMNS9" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PCOLUMNS9}]]></parameterValueExpression>
</crosstabParameter>
<crosstabParameter name="PCOLUMNS10" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PCOLUMNS10}]]></parameterValueExpression>
</crosstabParameter>
<crosstabParameter name="PCOLUMNS11" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PCOLUMNS11}]]></parameterValueExpression>
</crosstabParameter>
<crosstabParameter name="PCOLUMNS12" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PCOLUMNS12}]]></parameterValueExpression>
</crosstabParameter>
<crosstabParameter name="PCOLUMNS13" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PCOLUMNS13}]]></parameterValueExpression>
</crosstabParameter>
<crosstabParameter name="PCOLUMNS14" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PCOLUMNS14}]]></parameterValueExpression>
</crosstabParameter>
<crosstabParameter name="PCOLUMNS15" class="java.lang.String">
<parameterValueExpression><![CDATA[$P{PCOLUMNS15}]]></parameterValueExpression>
</crosstabParameter>
<crosstabHeaderCell>
<cellContents mode="Opaque">
<textField isStretchWithOverflow="true"
isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"
hyperlinkTarget="Self">
<reportElement mode="Opaque" x="0" y="264" width="10"
height="8" key="textFieldRowHeader -1" positionType="Float"
style="headerStyle" />
<textElement textAlignment="Left" verticalAlignment="Middle"
isStyledText="false" lineSpacing="Single" markup="html">
<font fontName="" size="-1" />
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{PROWS0}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true"
isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"
hyperlinkTarget="Self">
<reportElement mode="Opaque" x="0" y="0" width="10"
height="8" key="textFieldColumnHeader-1" positionType="Float"
style="headerStyle" />
<textElement textAlignment="Center"
verticalAlignment="Top" isStyledText="false" lineSpacing="Single"
markup="html">
<font fontName="" size="-1" />
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{PCOLUMNS0}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true"
isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"
hyperlinkTarget="Self">
<reportElement mode="Opaque" x="0" y="17" width="10"
height="8" key="textFieldColumnHeader-2" positionType="Float"
style="headerStyle" />
<textElement textAlignment="Center"
verticalAlignment="Top" isStyledText="false" lineSpacing="Single"
markup="html">
<font fontName="" size="-1" />
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{PCOLUMNS1}]]></textFieldExpression>
</textField>
.
.
.
.
请建议我如何解决此例外情况? 没有得到谷歌的任何解决方案...... :(
谢谢你, Navnath。
答案 0 :(得分:1)
我也经历过这样的事情。 但我仍然没有解决方案。
导致此错误的原因是,对于一个字段,您可能会有非常长的数据(如果打印的页数超过1页)。
CMIIW