在ireport中切换页面方向 [英] Switching page orientation in ireport

查看:834
本文介绍了在ireport中切换页面方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经读过没有办法使用iReport本地处理混合方向,但是阅读文档我想知道是否通过使用 JRDefaultScriptlet的beforePageInit()它可以以某种方式完成。在我的情况下,有一个肖像首页,与填充它们的数据一样多的横向页面,以及最后一个正面页面。

I've read there's no way to handle mixed orientations natively using iReport, however reading the documentation I wonder if by using JRDefaultScriptlet's beforePageInit() it could be accomplished somehow. In my case there's a portrait front page, as many landscape pages as there's data to populate them, and a last frontal page.

另一方面有人知道:

  • 如果这是在不久的将来支持的功能
  • 如果有替代方案按要求执行并生成符合jasper标准xml文件

提前致谢。

推荐答案

所以我决定玩iReport,看看有什么选择。事实证明,通过一些努力和想象,有可能实现这一目标。这假设您的第一页位于标题部分,而您的最后一页位于摘要部分。

So I decided to play around with iReport and see what options there where for this. Turns out it is sort of possible to pull off, with some effort and imagination. This is assuming your first page is in the Title Section, and your Last Page is in the summary section.


  1. 创建报告在横向模式下。

  1. Create your report in landscape mode.

在iReport中的报告属性下设置新页面上的标题新页面摘要为真。

Under Report Properties in iReport set Title on New Page and Summary on New Page to true.

假设您使用标准的8.5X 11字母大小的页面边距设置为20,将标题和摘要部分的高度设置为572.

Assuming you are using a standard 8.5" X 11" Letter sized page with all the margins set to 20, set the height of the Title and Summary sections to 572.

将静态文本字段添加到相应的部分。

Add your static text fields into the appropriate section.

现在,对于每个静态文本字段,您需要将 Rotate 属性设置为(实际上它可能是,关键是它们都需要相同。

Now for each static text field you need to set the Rotate property to Left (well it could actually be Right, the point is they all need to be the same.

当然,将所需的所有其他字段添加到页眉,数据等的相应频段中。

Of course add the all the other fields you want into the appropriate bands for page header, data, etc.

导出您的报告。

注意:如果您有任何图片需要进入标题或摘要部分您需要在iReport之外适当地旋转它们并保存它。然后将旋转的图像设置为报告中的图像。不幸的是,图像标记似乎没有旋转属性,因为这会使生活变得容易。

Note: if you have any images that need to go into the Title or Summary Section your will need to rotate them appropriately outside of iReport and save it. Then set the rotated image as the image in the report. Unfortunately the image tag does not seem to have a rotate property, as that would make life to easy.

此外,如果您未设置步骤2中列出的属性,则无法将Title和Summary波段的高度设置为适当的宽度。如果您正在使用不同尺寸的纸张和/或
边距,这是找出问题的简单方法e max size(这是你需要的)是将波段的高度设置为一个非常大的数字。然后它会弹出并告诉你它是大的,实际上是最大大小。

Also if you do not set the properties listed in step 2 you will not be able to set the height of the Title and Summary bands to the appropriate width. If you are using a different size paper and/or margins the easy way to figure out the max size (which is what you will need) is to set the height of the band to a very large number. It will then popup and tell you it is to large, and what the max size actually is.

这篇关于在ireport中切换页面方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆