- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我是 JasperReports 的新手。我做过一些简单的报告,但没有这么复杂。我在论坛上搜索了不止一天,但我就是无法让它发挥作用。
我收到的错误:
从 bean 检索字段值时出错:eventPlanTimeSlotBeanDataSet
如果有人能帮助我实现这一点,我将非常感激。
提前致谢,汤姆
我的 bean :
public class EventPlanTimeSlotBean {
private String timeSlot;
private List<OrganizerResultReportBean> orgResultBeans = new ArrayList<OrganizerResultReportBean>();
public EventPlanTimeSlotBean(String timeSlot, List<OrganizerResultReportBean> orgResultBeans) {
this.timeSlot = timeSlot;
this.orgResultBeans = orgResultBeans;
}
public String getTimeSlot() {
return timeSlot;
}
public void setTimeSlot(String timeSlot) {
this.timeSlot = timeSlot;
}
public List<OrganizerResultReportBean> getOrgResultBeans() {
return orgResultBeans;
}
public void setOrgResultBeans(List<OrganizerResultReportBean> orgResultBeans) {
this.orgResultBeans = orgResultBeans;
}
我的 jrxml 文件:
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="120"/>
<subDataset name="dataset1">
<field name="timeSlot" class="java.lang.String">
<fieldDescription><![CDATA[_THIS]]></fieldDescription>
</field>
</subDataset>
<parameter name="eventPlanNameParam" class="java.lang.String"/>
<parameter name="destinationNameColumnLabel" class="java.lang.String"/>
<parameter name="destinationCityColumnLabel" class="java.lang.String"/>
<parameter name="totalFlightCostsColumnLabel" class="java.lang.String"/>
<parameter name="timeSlotColumnLabel" class="java.lang.String"/>
<field name="eventPlanTimeSlotBeanDataSet" class="java.util.List"/>
<title>
<band height="110" splitType="Stretch">
<staticText>
<reportElement mode="Transparent" x="0" y="20" width="50" height="20" uuid="2af07c91-7b37-4c3a-8eea-53bfc065426e"/>
<text><![CDATA[Name:]]></text>
</staticText>
<textField isBlankWhenNull="true">
<reportElement mode="Transparent" x="60" y="20" width="300" height="20" uuid="2710e1b0-2493-409e-903b-381ddbb08392"/>
<textFieldExpression><![CDATA[$P{eventPlanNameParam}]]></textFieldExpression>
</textField>
</band>
</title>
<columnHeader>
<band height="30" splitType="Stretch">
<textField>
<reportElement mode="Transparent" x="0" y="5" width="100" height="20" uuid="d7a2f1cf-5325-4841-b46b-01c3c131d3ea"/>
<textFieldExpression><![CDATA[$P{timeSlotColumnLabel}]]></textFieldExpression>
</textField>
<textField>
<reportElement mode="Transparent" x="100" y="5" width="100" height="20" uuid="d7a2f1cf-5325-4841-b46b-01c3c131d3ea"/>
<textFieldExpression><![CDATA[$P{destinationNameColumnLabel}]]></textFieldExpression>
</textField>
<textField>
<reportElement mode="Transparent" x="200" y="5" width="100" height="20" uuid="cccc198b-10db-434d-b5c1-ddfcf0b3a0ab"/>
<textFieldExpression><![CDATA[$P{destinationCityColumnLabel}]]></textFieldExpression>
</textField>
<textField>
<reportElement mode="Transparent" x="300" y="5" width="100" height="20" uuid="cccc198b-10db-434d-b5c1-ddfcf0b3a0ab"/>
<textFieldExpression><![CDATA[$P{totalFlightCostsColumnLabel}]]></textFieldExpression>
</textField>
<line>
<reportElement mode="Opaque" x="0" y="24" width="511" height="1" uuid="ca213328-f473-4c93-a888-c1fd2181f0e4"/>
</line>
</band>
</columnHeader>
<detail>
<band height="25" splitType="Stretch">
<componentElement>
<reportElement x="100" y="0" width="400" height="20" uuid="320e66be-b719-4e1d-b1c8-9215179d7200"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="dataset1" uuid="056d45ca-4628-4bc5-bb1f-f44bb6d74c82">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{eventPlanTimeSlotBeanDataSet})]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="20" width="400">
<textField>
<reportElement x="0" y="0" width="100" height="20" uuid="db39f665-58b9-43ba-89dc-0d93e2f02a77"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$F{timeSlot}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
</band>
</detail>
填写报告:
try {
jasperPrint = JasperFillManager.fillReport(jreport, meetingResultMap,
new JRBeanCollectionDataSource(getDataSource(session, searchTask, eventPlan)));
} catch (JRException e) {
throw new LocalizedException("meeting_report_pdf_could_not_be_created" + ": " + e.getMessage());
}
最佳答案
终于成功了!
这是我的工作代码:
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="120"/>
<subDataset name="dataset1" uuid="6de4170d-97fa-4f08-bd45-f04be2f65e9f">
<field name="destinationName" class="java.lang.String"/>
</subDataset>
<parameter name="destinationNameColumnLabel" class="java.lang.String"/>
<parameter name="destinationCityColumnLabel" class="java.lang.String"/>
<parameter name="totalFlightCostsColumnLabel" class="java.lang.String"/>
<parameter name="timeSlotColumnLabel" class="java.lang.String"/>
<parameter name="eventPlanNameParam" class="java.lang.String"/>
<field name="orgResultBeans" class="java.util.List"/>
<field name="timeSlot" class="java.lang.String"/>
<title>
<band height="110" splitType="Stretch">
<staticText>
<reportElement mode="Transparent" x="0" y="20" width="50" height="20" uuid="2af07c91-7b37-4c3a-8eea-53bfc065426e"/>
<text><![CDATA[Name:]]></text>
</staticText>
<textField isBlankWhenNull="true">
<reportElement mode="Transparent" x="60" y="20" width="300" height="20" uuid="2710e1b0-2493-409e-903b-381ddbb08392"/>
<textFieldExpression><![CDATA[$P{eventPlanNameParam}]]></textFieldExpression>
</textField>
</band>
</title>
<columnHeader>
<band height="30" splitType="Stretch">
<textField>
<reportElement mode="Transparent" x="0" y="5" width="100" height="20" uuid="d7a2f1cf-5325-4841-b46b-01c3c131d3ea"/>
<textFieldExpression><![CDATA[$P{timeSlotColumnLabel}]]></textFieldExpression>
</textField>
<textField>
<reportElement mode="Transparent" x="100" y="5" width="100" height="20" uuid="d7a2f1cf-5325-4841-b46b-01c3c131d3ea"/>
<textFieldExpression><![CDATA[$P{destinationNameColumnLabel}]]></textFieldExpression>
</textField>
<textField>
<reportElement mode="Transparent" x="200" y="5" width="100" height="20" uuid="cccc198b-10db-434d-b5c1-ddfcf0b3a0ab"/>
<textFieldExpression><![CDATA[$P{destinationCityColumnLabel}]]></textFieldExpression>
</textField>
<textField>
<reportElement mode="Transparent" x="300" y="5" width="100" height="20" uuid="cccc198b-10db-434d-b5c1-ddfcf0b3a0ab"/>
<textFieldExpression><![CDATA[$P{totalFlightCostsColumnLabel}]]></textFieldExpression>
</textField>
<line>
<reportElement mode="Opaque" x="0" y="24" width="511" height="1" uuid="ca213328-f473-4c93-a888-c1fd2181f0e4"/>
</line>
</band>
</columnHeader>
<detail>
<band height="25" splitType="Stretch">
<componentElement>
<reportElement x="100" y="0" width="400" height="20" uuid="320e66be-b719-4e1d-b1c8-9215179d7200"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="dataset1" uuid="056d45ca-4628-4bc5-bb1f-f44bb6d74c82">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{orgResultBeans})]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="20" width="400">
<textField>
<reportElement x="0" y="0" width="100" height="20" uuid="db39f665-58b9-43ba-89dc-0d93e2f02a77"/>
<box leftPadding="10">
<topPen lineWidth="1.0"/>
<leftPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textFieldExpression><![CDATA[$F{destinationName}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
关于java - JasperReports JavaBeans 列表中的 JRBeanCollectionDataSource,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32518029/
我的 pom 中有以下插件: org.codehaus.mojo jasperreports-maven-plugin
我试图让 JasperReports 嵌入 JasperReports 字体 jar 中存在的字体(来自 DynamicJasper 生成的报告)。我在 jasperreports.propertie
我们在刚下载的 TomEE 应用服务器中出现了奇怪的行为。我们的情况:我们正在运行两个应用程序(我们称之为 v1 和 v2),它们通过使用 JasperReports 的 REST API 为我们提供
当jasperreport在java应用程序中导出为.pdf时,我们如何设置jasperreport的字体。 最佳答案 我需要将西里尔字体导出到 jasperreport 中以生成 pdf。字体必须包
我正在使用 Java 生成 jasper 报告。它有一个学生 bean,其中包含 College_name 和学生信息列表(第二个 bean)。Student_info包含student_Name和地
我正在升级标题中提到的 JasperReports 版本。JasperReports 版本升级我不是很了解。我必须更改所有内容才能使其正常工作。我有所有内容的最新 .jar 文件。但是当我打印我的 .
我想通过 Java 打印 JasperReports 的报告。 所以我写了如下代码 try { String r ="C:\\ireport\\Foods.jrxml";
尝试在 WebLogic 11g 上导出时,它会引发 NoClassDefFound 异常。我检查了应用程序 WAR 并且 jasperreports-3.7.4.jar 包含在 WEB-INF/li
我正在使用 GWT 构建一个网站,我想使用 JasperReports 在网站中加入一个报告生成器。报告绘制的所有数据都存储在云中的数据库中,因此我使用实例和云 sql 连接到数据库并检索/存储数据(
我想分享我对 JasperReports 或多或少常见错误的经验。 在执行JasperReports制作PDF报表时出现异常: java.lang.NoClassDefFoundError: Coul
我正在使用 grails 版本 2.4.0 和 JasperReports 插件:1.9.0(也尝试过版本 jasper-1.10.0-SNAPSHOT),但是当我导出到 pdf 时出现错误。 当我第
我正在尝试使用 java 代码从 jrxml 文件制作 pdf,但它给了我以下错误: SEVERE: Parse Error at line 2 column 487: Document root e
我在 docker openjdk:11.0.1-jdk-slim 内运行 jasperreports 没有错误。 内部openjdk:11.0-jdk-slim(openjdk版本“11.0.6”2
我非常接近这项工作,我试图直接将一个 jasper 子报告嵌入到另一个的主报告 xml 中。你会认为这很容易,但我找不到一个关于这样做的例子。每个人似乎都在使用文件或资源或其他任何东西。我有一个直接从
出于某种原因,我的带有日期和页面 x/y 的页脚只打印在最后一页。有谁知道为什么? 我正在使用 JasperReports 3.1.2和 iReport 3.0.0 . 编辑 :只是为了记录:在我从
这应该是一个关于 JasperReports 的简单问题。我正在尝试对整个报告做一个简单的计数器,该计数器应根据条件递增。但是,无论我尝试什么,似乎计数器变量总是在递增,无论变量表达式如何。我的变量的
有没有办法对 JasperReport 的大小设置限制?我们刚刚查看了一个 WebSphere 6.1 Heapdump,有人试图创建一个报告,结果堆中有 1.5GB 的内存。它使我们的 Websph
我希望在我的项目中使用 JasperReports 4.5.0,并且想知道仅生成 PDF 的最小依赖项是什么。我尝试浏览他们的网站和自述文档,但一无所获。我也遇到过这个installation wik
我只想将数据集中的唯一值打印到列表组件中,避免重复值。 怎么做? 附言我正在使用XML作为数据源。 最佳答案 使用X-Path在数据源中选择节点时,请尝试以下类似的操作。 /root/*[not(te
我想要让 JasperReports 子报表中的行交替显示颜色。我的所有行都具有相同的背景颜色,但我希望它交替。这可以吗? 最佳答案 是的,可以set up a style在 JRXML 文件中,如下
我是一名优秀的程序员,十分优秀!