在Java中更改Jasper报表的页面方向
我正在使用*。jasper报告是用Java程序中的iReport生成的。我需要以编程方式更改报告方向。这是我的密码:
final File template = new File("report.jasper");
final JasperReport jasperReport = (JasperReport) JRLoader.loadObject(template);
//connection is defined previously
final JasperPrint print = JasperFillManager.fillReport(jasperReport, metadata, connection);
//reprot.jasper is defined with LANDSCAPE orientation
print.setOrientation(OrientationEnum.PORTRAIT);
最后一行对生成的pdf或屏幕组件都没有影响
有什么想法吗
# 1 楼答案
更改JasperPrint对象的方向不会更改生成页面的宽度或高度。 我认为你需要在填写报告之前更改页面方向
还有一些details