多个raq导出一个excel2007中

    xiaoxiao2021-12-14  17

    

    需求描述:          客户以前通过润乾API把多个raq模板数据来导出到一个excel文件中,由于现在数据量过大一个raq数据就超过了65535,原来的2003接口已经满足不了现在的需求,要使用导出2007接口才可以,新的report4.jar已经提供了相应接口

    实现方法 下面给出一个示例参考 List<String> list = new ArrayList<String>(); list.add(“wanggeshi.raq”); list.add(“456.raq”);

    Date currentTime = new Date(); SimpleDateFormat formatter = new SimpleDateFormat(“yyyy-MM-dd hhmmss”); String dateString = formatter.format(currentTime); String saveurl = “D:\\test\\” + dateString + “.xlsx”;

    String lic = “D:\\test\\1234.lic”;

    ExtCellSet.setLicenseFileName(lic); //设置授权文件

    try { //来自 com.runqian.report4.ide.usermodel.ReportExporter 这个类  ReportExporter re = new ReportExporter(saveurl, ReportExporter.EXPORT_EXCEL2007);   for (int i = 0; i < list.size(); i++) {   // 读入报表   ReportDefine rd = (ReportDefine) ReportUtils.read(“D:\\test\\”+list.get(i).toString());   Context cxt = new Context();   Engine engine = new Engine(rd, cxt);   // 计算报表   IReport report = engine.calc();   // 添加sheet页   re.addSheet(report, list.get(i).toString());   }   re.save();  } catch (Throwable e) {   e.printStackTrace();  }  out.println(“导出完成!”); %>

    转载请注明原文地址: https://ju.6miu.com/read-965238.html

    最新回复(0)