Jasper表组件 [英] Jasper table component
问题描述
我正在尝试生成包含表格的报告。这些是jrxml的重要部分:
I am trying to generate a report containing a table. These are the important parts from the jrxml:
<jasperReport
<subDataset name="Table Dataset 1">
<field name="field1" class="java.lang.String"/>
</subDataset>
<summary>
<jr:table>
<datasetRun subDataset="Table Dataset 1">
<dataSourceExpression>
<![CDATA[$P{REPORT_DATA_SOURCE}]]>
</dataSourceExpression>
</datasetRun>
<jr:column width="90">
<jr:columnHeader>...</jr:columnHeader>
<jr:detailCell height="20">
<textField>
<textFieldExpression class="java.lang.String">
<![CDATA[$F{territory}]]>
</textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:table>
</summary>
</jasperReport>
我传递给报告的数据源类型是JRBeanArrayDataSource,看起来没问题,因为数据显示在报告中(如果我在主表中使用$ F {field1} - 在表格外)。
The type of datasource I am passing to the report is a JRBeanArrayDataSource, which seems to be ok, because the data appears in the report (if I am using $F{field1} in the master - outside the table).
你看到我的方式有问题吗?使用表组件?
我没有看到任何错误......但表格没有显示...只有一条水平线而不是表格。
Do you see something wrong in the way I am using the table component? I don't see any errors...but the table is not being displayed...only a horizontal line instead of the table.
推荐答案
我遇到了同样的问题,在这里找到了解决方案
https://web.archive.org/web/20111130110022/http://thilosdevblog.wordpress.com/2011/03/27 / beans-in-jasperreports4 /
I had the same problem and found the solution here https://web.archive.org/web/20111130110022/http://thilosdevblog.wordpress.com/2011/03/27/beans-in-jasperreports4/
表数据源必须如下所示:
the table datasource has to be like this:
<datasetRun subDataset="TableDataset">
<datasetParameter name="REPORT_DATA_SOURCE">
<datasetParameterExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></datasetParameterExpression>
</datasetParameter>
</datasetRun>
想知道为什么这种东西不在jasper / ireport常见问题中!
Wonder why this kind how stuff is not in the jasper/ireport FAQ !
这篇关于Jasper表组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!