iReport3.7轻松实现套打布局
1。配置环境
iReport3.7版本连接
http://downloads.sourceforge.net/project/ireport/iReport/iReport-3.7.0/iReport-3.7.0.zip?use_mirror=nchc
及会计凭证图片如下:
2.新建一个报表模板
一切默认。进入编辑界面后。
2.1 点Format--Page format...
2.2 设置Width=685 pixels 和Height=324 pixels这个是凭证图片的宽和长.
Page orientation为Landscape
Margins的 Top,Bottom,Left,Right都设置为0
2.3 在Report Inspector中保留Detail 1删除其他的Band
2.4 选中Detail 1 设置Band height=324 与图片相同高度。
3. 拖入Image组件设置上面图片的位置,然后放置到Detail 1正中间。
现在的图片为背景图,上面可以放置你需要的套打内容。
如果需要显示的内容被挡住,就需要右击刚才的背景图选Send To Back。
这样用背景图来控制报表的打印应该很准确了。
至于打印的时候是否显示背景图需要设置它的Print When Expression比如:
new Boolean("1" == $P{isPrint})
在Report Inspector的Parameters中添加一个Parameter Class = java.lang.String型的Name = isPrint就ok.