我想在 ireport 中创建多个组,并且数据应该以分组方式显示。例如:首先应该完全打印 Group1 数据,然后,
第一组:
模块数据 在此之后我想完全打印 Group2 数据
组2:
类别数据
我正在使用结果集数据源。
有人可以帮助我吗?
该jasperPrint对象有纵向,但jasperPrint2对象有横向.我想结合两个jasperprints来生成一个pdf文件,但保持其原始方向.当我将jasperPrint2的页面添加到jasperPrint时,最终的jasperPrint具有纵向方向......我测试了jasperPrint.setOrientation(JasperReport.ORIENTATION_LANDSCAPE)但没有改变.
如何从保存原始方向的两个jasperprints生成一个pdf文件?
我有以下代码:
JasperReport report = (JasperReport) JRLoader.loadObject(reportFile2.getPath());
jasperPrint = JasperFillManager.fillReport(report, parameters, conn);
JasperReport report2 = (JasperReport) JRLoader.loadObject(reportFile.getPath());
jasperPrint2 = JasperFillManager.fillReport(report2, parameters, conn);
List pages = jasperPrint2.getPages();
for (int j = 0; j < pages.size(); j++) {
JRPrintPage object = (JRPrintPage) pages.get(j);
jasperPrint.addPage(object);
}
Run Code Online (Sandbox Code Playgroud) 我是HTML和Java的初学者,我试图通过使用HTML和Java的Web视图在Android上的简单Web应用程序中播放音频文件.我成功地让它在Android 4.0上运行.但它不适用于2.3.3或2.2.我做了很多研究,到目前为止,我发现它不受支持.任何人都可以确认或否认这一点并可能指出我正确的方向吗?这是我在4.0上工作但没有别的.
WebView engine = (WebView) findViewById(R.id.web_engine);
String audioTest = "< html >" + <br/>
"< body >" + <br/>
"< audio id='egSound' preload='auto' autoplay ='autoplay'>" + <br/>
"< source src=' www.egSoundUrl.com '>" +
"< /audio>" + <br/>
"< /body>" +
"< /html>";
engine.loadData(audioTest, "text/html", null);
Run Code Online (Sandbox Code Playgroud)
如何获得相同的代码才能使用2.3.3?在我的研究中,我遇到了一个能够使用视频标签播放音频文件的人,但我无法实现这一点.任何共享的知识将不胜感激.
我有一个标题带,其中包含一个包含计算变量的文本字段.该文本字段有evaluationTime设为报告,同为变量resetType.现在,我正在尝试使用条件样式设置此字段的背景颜色,但我不断收到一条错误消息,说明: $V{avg_perc}
Invalid expression: !Double.isNaN($V{avg_perc}) && $V{avg_perc} >= 0.8
Run Code Online (Sandbox Code Playgroud)
我在做同样的事情用相同的条件样式在列脚注和它的作品没有任何问题,即使我设置evaluationTime对这一领域的报告了.
删除后!Double.isNaN($V{avg_perc})我不再出现错误,但表达式仍然无效.我的字段保持红色,这是任何条件无效时的基本颜色,无论哪个值$V{avg_perc}有.但它仍然可以在Column Footer中使用.这是我的风格:
<style name="avg_color" mode="Opaque" backcolor="#FF0000" pdfFontName="Helvetica-Bold">
<conditionalStyle>
<conditionExpression><![CDATA[$V{avg_perc} >= 0.8]]></conditionExpression>
<style backcolor="#008000"/>
</conditionalStyle>
<conditionalStyle>
<conditionExpression><![CDATA[$V{avg_perc} >= 0.6 && $V{avg_perc} < 0.8]]></conditionExpression>
<style backcolor="#FFCC00"/>
</conditionalStyle>
</style>
Run Code Online (Sandbox Code Playgroud)
使用的字段和变量:
<field name="perc" class="java.lang.Double"/>
<variable name="avg_perc" class="java.lang.Double" calculation="Average">
<variableExpression><![CDATA[$F{perc}]]></variableExpression>
</variable>
Run Code Online (Sandbox Code Playgroud)
知道如何让这个东西工作吗?我在3.7.4版本中使用JasperReports和 …
我正在使用JasperReports创建发票.
我有一个详细信息部分,其中包含所有项目的列表,后面是包含总计,税收等的列页脚,然后是" 摘要"部分中的退货政策.
我想始终确保详细信息后跟列页脚,后跟摘要条带.我们怎样才能确保这一点?我发现有时摘要出现在列页脚之前.
有人可以对此有所了解吗?
我创建了一个报告,该报告基本上是员工填写的时间表,因此它是一个表格,其中一行设计为预先填写员工的数据(例如:姓名/姓氏......).
我的SQL请求检索了16个员工记录.一个页面只包含13行,因此它会自动为最后3行创建第二页.我的问题(和要求)是创建一个包含13行的第二页,其中3行将填充记录,其中10行将留空.
这是一个例子:

我怎样才能做到这一点?
如果我想创建一个包含13个空行的额外页面怎么办?
有谁可以帮助我吗?
我正在使用iReport 3.6.
我有一个JavaBean类,它具有以下代码:
private Collection<String> containerNumber;
public Collection<String> getContainerNumber()
{ return containerNumber; }
public void setContainerNumber(Collection<String> pContainerNumber)
{ this.containerNumber = pContainerNumber; }
Run Code Online (Sandbox Code Playgroud)
当我让iReport 3.6读取这个JavaBean时,它会看到一个Collection(这就是我想要的).但我想在报告中将此集合显示为动态列表/字段.因此,当setContainNumber设置1个容器编号时,报告显示1个容器.当setContainerNumber设置10个容器时,报告显示10个容器.在我的报告中的容器下面,我有更多的字段,当它显示10个容器时,这些字段应该删除10个容器空间.当它显示1个容器时,这些字段应该丢弃1个容器空间.
我的问题:如何使用字符串集合显示动态列表作为JavaBean数据源?
下面的代码得到一个byte[]结果,适用于PDF和XLSX.对于HTML,引发了异常.
JasperPrint jasperPrint = JasperFillManager.fillReport(report,
params, dataSource != null ? new JRMapArrayDataSource(
dataSource) : new JREmptyDataSource());
ByteArrayOutputStream out = new ByteArrayOutputStream();
@SuppressWarnings("rawtypes")
Exporter exporter;
switch (format) {
case PDF:
exporter = new JRPdfExporter();
break;
case XLSX:
exporter = new JRXlsxExporter();
break;
case HTML:
exporter = new HtmlExporter();
break;
default:
throw new ReportException("Unknown export format");
}
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(out));
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.exportReport();
return out.toByteArray();
Run Code Online (Sandbox Code Playgroud)
HTML的例外情况就是 exporter.exportReport();这样
java.lang.ClassCastException:
net.sf.jasperreports.export.SimpleOutputStreamExporterOutput cannot be cast to net.sf.jasperreports.export.HtmlExporterOutput
at net.sf.jasperreports.engine.export.HtmlExporter.exportReport(HtmlExporter.java:232)
Run Code Online (Sandbox Code Playgroud)
v6.0和v5.6的错误相同.这曾经在v5.0中工作(某些类在v5.6中已弃用).
如何以各种格式导出报告,包括HTML?
我想在现在的日期前六个月得到一个日期.我尝试的代码是:
SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd");
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, -6);
System.out.println(format.format(c.getTime()));
Run Code Online (Sandbox Code Playgroud)
但是我希望将它减少为单行表达式,我想在我的Jasper报告中使用它来放入参数表达式.
如何将其减少为单行表达式?
我必须使用相同的图表报告模板创建具有不同数据集的多个XY线图,我还必须使用JRBeanCollectionDatasource.
要求:
1)应该使用JRBeanCollectionDatasource来完成.
2)必须使用相同的图表报告模板来创建多个图表.
3)图表的数量没有固定(这里我有问题在java中给出报告参数的名称).因为在ReportParametersMap中,它们只能具有唯一的键名.
Java的:
Coordinates.java
private Number series;
private Number xCoordinate;
private Number yCoordinate;
//Getters & Setters
Run Code Online (Sandbox Code Playgroud)
GenerateReport.java
我正在使用报告手册,报告手册的每个报告模板都被视为子报告.所以我传递XYChartDataSource(java.util.List)到主报告书,我将使用子报表将此参数映射
new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{XYChartDataSource})为数据源表达式.
在Subreport中,我XYChartDataSource在MainDataset中创建了一个参数(java.util.List)并创建了字段(series,xCoordinate,yCoordinate)(在图表中使用)
List<List<Coordinates>> allchartData = new ArrayList<>();
List<Coordinates> chartData = new ArrayList<>();
chartData.add(new Coordinates(2.08, xCoordinate, yCoordinate));
chartData.add(new Coordinates(2.08, xCoordinate, yCoordinate));
chartData.add(new Coordinates(2.08, xCoordinate, yCoordinate));
allchartData.add(chartData);
.
.
.
chartData.add(new Coordinates(2.12, xCoordinate, yCoordinate));
chartData.add(new Coordinates(2.12, xCoordinate, yCoordinate));
chartData.add(new Coordinates(2.12, xCoordinate, yCoordinate));
allchartData.add(chartData);
.
.
.
for (int i = 0; i < baselineChartData.size(); i++) …Run Code Online (Sandbox Code Playgroud)