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(“导出完成!”);
    %>

  • 相关阅读:
    Anaconda 和 Jupyter notebook
    DOM基础之创建元素
    python爬虫入门学习3 Requests请求库
    04 字典类型已内置方法
    05 流程控制
    03 可变类型与不可变类型
    02 元组数据类型
    01 列表内置方法
    day2笔记
    00 python基础知识
  • 原文地址:https://www.cnblogs.com/shiGuangShiYi/p/10117511.html
Copyright © 2011-2022 走看看