如何生成水平跨多个页面的 PDF 报告
我必须生成包含许多(在运行时定义)列的 PDF 报告。当用户选择显示多个字段时,这些报告可能会水平跨越多个页面。我正在使用 DynamicJasper,当所有列都适合一页时,可以成功生成动态报告。如果不这样做,报告将被裁剪并且仅显示几列。我尝试在运行时更改页面宽度,但报告未被裁剪,但由于页面尺寸不标准,因此无法正确打印。生成此类报告的正确方法是什么?
目标是在大表超出页面宽度时将其拆分为多个页面,例如打印电子表格时。
使用JasperReports可以实现吗?
I have to generate PDF reports with many (defined at runtime) columns. These reports may span multiple pages horizontally when user selects many fields to show. I'm using DynamicJasper and could successfully generate dynamic reports when all the columns fit in one page. When they don't, report is cropped and only a few columns are shown. I've tried changing the page width in runtime and report is not cropped, but it can't be printed correctly because page size is not standard. Which is the right way to generate this kind of reports?
The goal is to split big tables in multiple pages if they exceed page width, like when printing a spreadsheet.
Is it possible to achieve it using JasperReports?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您还想打印报告,因此您必须使用标准打印尺寸(例如 A4 和 A3)和横向打印,因为宽度是问题。
要在页面上获得最大可能:
1)使用较小的字体
2)使用横向页面方向
3) 使用较大的页面尺寸(A3、A2...),只要您的打印机可以处理即可。
如果您仍然无法适应页面,请考虑如何布置结果 - 您想要什么看看是否有人给了你一张很大的桌子?您需要将表拆分为一页的一些列和另一页的一些列。
希望有帮助。
Since you also want to print the report, you will have to work from standard print sizes (such as A4 and A3) and a landscape orientation since width is the issue.
To get the most possible on a page:
1) Use smaller fonts
2) Use landscape page orientation
3) Use a larger page size (A3, A2...) as long as your printer can handle it
If you still can't fit on a page, think about how you want to lay out the result - what would you like to see if someone gave a really big table to you? You will need to split the table into some columns for one page and some columns for another.
Hope that helps.