ireport开发大全,分页以及超链接,导出excel

@RequestMapping("seatCheckInAndCheckOutQuery")
public ModelAndView seatCheckInAndCheckOutQuery(HttpServletRequest request,SignIn sign, String format ,HttpServletResponse response) throws Exception{


JasperDesign jdesign = JRXmlLoader  
                 .load("D:/callcenter2017uat/callcenter/WebRoot/WEB-INF/jasper/actionDataJasper/seatCheckInAndCheckOut.jrxml");  
HashMap map = new HashMap();
if(null != sign.getSignInId() && !"".equals(sign.getSignInId())){
map.put("signInTime","1");
}
JasperReport jreport = JasperCompileManager.compileReport(jdesign);  
List<JasperInfoTen> list = signService.findSeatCheckInAndOutCondtion(sign);
JRDataSource jrDataSource = new JRBeanCollectionDataSource(list);
JasperPrint jprint = JasperFillManager.fillReport(jreport, map,  
jrDataSource);
        if("html".equals(format)){
        JasperExportManager.exportReportToHtmlFile(jprint,  
                "D:\\BaiduMusic\\demo.html"); 


        }else{
        SimpleXlsxReportConfiguration conf = new SimpleXlsxReportConfiguration();
       conf.setOnePagePerSheet(Boolean.FALSE);
       conf.setRemoveEmptySpaceBetweenRows(Boolean.FALSE);
       conf.setWhitePageBackground(Boolean.FALSE);
       JRXlsExporter exporter = new JRXlsExporter();
       exporter.setConfiguration(conf);
       ExporterInput exporterInput = new SimpleExporterInput(jprint);
       exporter.setExporterInput(exporterInput);
       OutputStreamExporterOutput exporterOutput = new SimpleOutputStreamExporterOutput("D:\\BaiduMusic\\demo.xls");
       exporter.setExporterOutput(exporterOutput);
       exporter.exportReport();
      return null;
        }
//        
       //ireport实现导出excel
      
//        ByteArrayOutputStream outPut=new ByteArrayOutputStream();  
//        FileOutputStream outputStream=null;  
//        File file=new File("D:\\BaiduMusic\\demo.xls");  
//       
//        try {  
//          
//        JRAbstractExporter exporter = new JRXlsExporter();  
//        //创建jasperPrint  
//            exporter.setParameter(JRExporterParameter.JASPER_PRINT,jprint);  
//            //生成输出流  
//            exporter.setParameter(JRExporterParameter.OUTPUT_STREAM,outPut);  
//            //去除两行之前的空白  
//            exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE);  
//            //设置所有页只打印到一个Sheet中  
//            exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET,Boolean.FALSE);  
//            //设置Excel表格的背景颜色为默认的白色  
//            exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND,Boolean.FALSE);  
//            exporter.exportReport();  
//            outputStream=new FileOutputStream(file);  
//            outputStream.write(outPut.toByteArray());  
//        } catch (JRException e) {  
//            e.printStackTrace();  
//        }catch (Exception e) {  
//            e.printStackTrace();  
//        }finally{  
//            try {  
//                outPut.flush();  
//                outPut.close();  
//            } catch (Exception e) {  
//                e.printStackTrace();  
//            }  
//        }  
       
       
//        response.sendRedirect("/actionDataJasper/demo.html");
ModelAndView mv = new ModelAndView();
mv.setViewName("/actionDataJasper/demo");
return mv;
}


}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值