zoukankan      html  css  js  c++  java
  • 多个raq导出一个excel2007中

    

    需求描述:
             客户以前通过润乾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(“导出完成!”);
    %>

  • 相关阅读:
    python--输出spwm的数组
    爬虫二:爬取糗事百科段子
    爬虫一:爬取信息
    Python中的切片操作
    JSON
    python 中的异常处理与种类
    register的功能
    static的功能
    网络安全的认识
    VMware5.5-vCenter Converter(转换)
  • 原文地址:https://www.cnblogs.com/shiGuangShiYi/p/10117511.html
Copyright © 2011-2022 走看看