JasperReport+iReport报表中同一个excel中建立多个sheet页以及自定义命名sheet的名称

由于工作的需要,需要将多个jasper导入到一个excel中,并且是放置到不同的sheet页中,

研究了下需要做如下操作

JRXlsExporter xls = new JRXlsExporter();
xls.setParameter(JRExporterParameter.JASPER_PRINT_LIST,list);//此处的list为JasperPrint的list集合 xls.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);//设置为true,即可在一个excel中,每个单独的jasper对象放入到一个sheet页中

String[] sheetNames = {"自定义1","自定义2","自定义3"};
xls.setParameter(JRXlsExporterParameter.SHEET_NAMES, sheetNames);//此处这样写即可

一些小技巧,与大家分享一下!

 

 

 

posted @ 2013-04-19 17:35  古来征战几人回  阅读(3098)  评论(0编辑  收藏  举报