java 打印无页的 Jasper 报告

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1771638/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 17:55:13  来源:igfitidea点击:

Print Jasper Report without pages

javajasper-reports

提问by Maksim

I'm creating HTML (popup window), EXCEL and PDF report and would like to show my reports on one page. This report is not going to be used for printing, so there is no need separate my report into pages. Plus later users would like to use Buildin Excel sorting.

我正在创建 HTML(弹出窗口)、EXCEL 和 PDF 报告,并希望在一页上显示我的报告。该报告不会用于​​打印,因此无需将我的报告分成几页。加上后来的用户想使用 Buildin Excel 排序。

Is there an option to ignore pages?

是否有忽略页面的选项?

回答by Jukka

Toggle paginationduring report filling. For example, Excel or HTML output should not be paginated. Sample code:

在报告填写期间切换分页。例如,不应对 Excel 或 HTML 输出进行分页。示例代码:

parameters.put(JRParameter.IS_IGNORE_PAGINATION, true);
JasperPrint print = JasperFillManager.fillReport(report, parameters, data);

回答by DrewM

Under the Report Properties in the "More . . ." section. There is a Ignore Pagination option. Check this box and it should work

在“更多...”中的“报告属性”下 部分。有一个忽略分页选项。选中此框,它应该可以工作

回答by Matthew Farwell

I don't know if there an option to ignore pages, but you can change the page height to a very big number (10000)?

不知道有没有忽略页面的选项,但是你可以把页面高度改成一个很大的数字(10000)?

In the XML, set the pageHeight attribute to "10000", or similar.

在 XML 中,将 pageHeight 属性设置为“10000”或类似的。

回答by waxwing

As an alternative to checking "Ignore pagination", you should be able to get a similar effect by setting the page bands' height to zero. At least for Excel and HTML reports, not sure about PDF.

作为检查“忽略分页”的替代方法,您应该能够通过将页带的高度设置为零来获得类似的效果。至少对于 Excel 和 HTML 报告,不确定 PDF。

This is helpful for large reports when you want to use Jasper's Virtualizer feature. The reason is that the virtualizer stores entire pages on disk, and if you enable ignore pagination, you will not get the benefit from the virtualizer and risk running out of memory.

当您想要使用Jasper 的 Virtualizer 功能时,这对于大型报告很有帮助。原因是虚拟化器将整个页面存储在磁盘上,如果启用忽略分页,您将无法从虚拟化器中受益,并且存在内存不足的风险。

回答by oraclesoon

My project is using net.sf.jasperreports.engine.JasperReport ver 3.6.1 to generate csv file and surprisingly I see the csv output file is inserted with alternate ,,1,,, and ,,9,,, at every 42nd line.

我的项目正在使用 net.sf.jasperreports.engine.JasperReport ver 3.6.1 来生成 csv 文件,令人惊讶的是我看到 csv 输出文件在每 42 行插入了备用 ,,1,,, and ,,9,,, .

Refer here: http://jasperreports.sourceforge.net/sample.reference/nopagebreak/

请参阅此处:http: //jasperreports.sourceforge.net/sample.reference/nopagebreak/

I added the following setting in the jrxml template

我在 jrxml 模板中添加了以下设置

<jasperReport ... isIgnorePagination="true" ...> 
... 
</jasperReport>

and the empty line is gone.

空行不见了。